Spaces:
Running
Running
Commit ·
615c2b5
1
Parent(s): 4f7d500
patch
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- assets/hierarchy.js +1 -1
- assets/highlight.css +4 -4
- assets/navigation.js +1 -1
- assets/search.js +0 -0
- classes/types.ActionBase.html +0 -0
- classes/types.BrokerBase.html +0 -0
- classes/types.MarkdownFileBase.html +9 -9
- classes/types.MarkdownFolderBase.html +4 -4
- classes/types.MemoryBacktestAdapter.html +18 -15
- classes/types.MemoryLiveAdapter.html +18 -15
- classes/types.Performance.html +8 -8
- classes/types.PersistBase.html +10 -10
- classes/types.PersistBreakevenInstance.html +56 -0
- classes/types.PersistCandleInstance.html +63 -0
- classes/types.PersistIntervalInstance.html +60 -0
- classes/types.PersistLogInstance.html +51 -0
- classes/types.PersistMeasureInstance.html +59 -0
- classes/types.PersistMemoryInstance.html +70 -0
- classes/types.PersistNotificationInstance.html +50 -0
- classes/types.PersistPartialInstance.html +56 -0
- classes/types.PersistRecentInstance.html +58 -0
- classes/types.PersistRiskInstance.html +52 -0
- classes/types.PersistScheduleInstance.html +54 -0
- classes/types.PersistSessionInstance.html +57 -0
- classes/types.PersistSignalInstance.html +55 -0
- classes/types.PersistStateInstance.html +55 -0
- classes/types.PersistStorageInstance.html +50 -0
- classes/types.Position.html +3 -3
- classes/types.ReportBase.html +8 -8
- classes/types.StateBacktestAdapter.html +14 -12
- classes/types.StateLiveAdapter.html +14 -12
- documents/article_01_look_ahead_bias.html +0 -0
- documents/article_02_second_order_chaos.html +0 -0
- documents/article_03_claude_trader.html +6 -6
- documents/article_04_option_hedging.html +3 -3
- documents/article_05_ai_strategy_workflow.html +3 -3
- documents/article_06_ai_strategy_blueprint.html +0 -0
- documents/article_07_ai_news_trading_signals.html +1 -1
- documents/article_08_ai_liquidity_harvesting.html +1 -1
- documents/article_09_pinescript_local_markets.html +3 -3
- documents/article_10_dca_averaging_strategy.html +1 -1
- documents/begin_02_getting_started_configuration.html +1 -1
- documents/begin_12_backtest_module_frame_configuration.html +1 -1
- documents/begin_18_risk_management.html +5 -5
- documents/begin_22_symbol_configuration.html +1 -1
- documents/cli_readme.html +0 -0
- documents/demo_backtest_readme.html +13 -13
- documents/demo_exchange_readme.html +10 -10
- documents/demo_live_readme.html +0 -0
- documents/demo_optimization_readme.html +8 -8
assets/hierarchy.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
window.hierarchyData = "
|
|
|
|
| 1 |
+
window.hierarchyData = "eJylmc1u2zgUhd9Fa7Yj/ogUvWtdFAiaDgxnMF0MuuBIjCJYlgqR7kxa5N0Lmo5NyZRFqpvYiXV0PvJekfTJz6TvOq2S1T8w4ymAjEIAc8YBzDkFkKccQI4ggBznAHLCAOSUAMhz8wHPAUohBChF5gdGAKXEvMswQCk1vzICEOQMIGzekTwDiPAMoCwlgDDEv4Kkl4+NLHTdtSpZ/UwgIsi8tmIvk1Xyvu92sn8vlExAsqvbMllBlIPk0DfJKikaoZRUf+jnb1K9vVz79knvmwTYz5NVolX5xojf2D+8gMSM17G5s9qzB8roq0fdatk/iuJsc7p20uMsMB8+1U3Zy9bMMCLoq3Fm2B3g3X1Xhdned1WA59GBwpFDFTo2e2302Bi2Y8sZd503sle10oPy3bR3BLEMGGe5ZeDUx9BLsZPfZXvXKi3aIhJorI6n4+RIx1PfDK1FWzZyEdpQGs1FILNcCHq47ozqu2gWkY3F8WyYWzace9juu2oRlqOLJ6LQEhHmIfoshTr0y8o40saTsVN/UeIl23f980IwVxrPxanlyn19/2en68e6EGb5X0Tnu0E0Y4ZOfcZ9fbYRva4XPgIjbTwZOVbVbLMesq0sZKsXgQ2l8VyUWS7vqrGt1W4ZlSOMZ+LQMg3319OtH4onWR4WrrFjcTQbhSc24puvB6nU0gdgpI0nw6kly7CPrK7aha0/lMZzZchyUW81tdALS+kq46nYqY7Mt8o+6K4X1VKugTae7NT9EA7OtZvDv01d2Fpsu/8CkYaiWBaETt0O+WCXNE/3+kkWu3d9pcJIBpJ4DnrcewzPmCNyRgaSsFO4cR+7/i2aujzuVRvx3HSiDHe/koZSsEENXley0o5mbXotfBqm1IEsGPIbLEspFnUos/sXHj7H9oYfdBcI8np5tD/OMUCY2yUO5/ga4vXwHAnjyEKLwtG1e3gtFpcAwhSYjjhOAclGU/CjbquN6MVevftrG4oyEAUOn1Ay5fyx/l+WG9mbk5KoApfzGzcIJRr35OWGn2TTPMdzHGWh7nl27W6euL2IrMRZFN0aJMO2K/gky2/UxnuDeEZqT+ZZ6qmWtYiuliOL57Hf/xBlg13ni2h2st9KdWh04J47kIR1jcleHFdf7DOZ2oVEPufYzsQoHqPJbGfWNTjXuSAQyK4RJgKcOf/A8MYxx/zafDKlmbMPTmgcgEG2eCOKmfMOiWEcW+ap+1TeMmcdmrU49oNM8XaoMu8eFKhczDPkqfnN5GQOISo1cUCIpwhT8cgcQ2g04thTz4M3kYHMuQfmH4459/S9N+iYtQ4JOS7GFHqMJ9OMOfPgJMMBwKkHYCKymPUPjCsc+wx57P25xKx7WCbhmDPf5HvDh1nvoODBsfY13FTCMG8eli6c7c0/5xx7eyZYd/tvjdRy3bW6F4UOOk/4pdHnG8ooIIwevzGZ1ys4M7+10nWhPnelbCLYRsqQI8/Lyy8Q8dUz"
|
assets/highlight.css
CHANGED
|
@@ -7,10 +7,10 @@
|
|
| 7 |
--dark-hl-2: #CE9178;
|
| 8 |
--light-hl-3: #0000FF;
|
| 9 |
--dark-hl-3: #569CD6;
|
| 10 |
-
--light-hl-4: #
|
| 11 |
-
--dark-hl-4: #
|
| 12 |
-
--light-hl-5: #
|
| 13 |
-
--dark-hl-5: #
|
| 14 |
--light-hl-6: #008000;
|
| 15 |
--dark-hl-6: #6A9955;
|
| 16 |
--light-hl-7: #098658;
|
|
|
|
| 7 |
--dark-hl-2: #CE9178;
|
| 8 |
--light-hl-3: #0000FF;
|
| 9 |
--dark-hl-3: #569CD6;
|
| 10 |
+
--light-hl-4: #001080;
|
| 11 |
+
--dark-hl-4: #9CDCFE;
|
| 12 |
+
--light-hl-5: #AF00DB;
|
| 13 |
+
--dark-hl-5: #C586C0;
|
| 14 |
--light-hl-6: #008000;
|
| 15 |
--dark-hl-6: #6A9955;
|
| 16 |
--light-hl-7: #098658;
|
assets/navigation.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
window.navigationData = "eJytfdmS3MiV5b/Q5lE14r7ojUUWW6lmVbHJHOmhTQYDEZ6R6EQA0QAiyay2/vcxh2Px5fq954J64hJncfi++3/+z6PRfB8f/eVR2Y911ZhHf3pU3dbNoTfto7/85/rr4ydF03V3RXlrykPxtS6HR396dC7H20d/eXToqsvJtOPw51mjSNH/93Y8NY/+9Oiubg+P/vL62evXLx+//t8/bfpPi8FUXXsouv5g+qK6LTvegiKILs+KqikvB1OMfXkwPWsQYUXt50V3HuuuLW7N4Vi3R1Y8BovqL4qyLoaxL0dzfCi+df3dTdN9Yz1oiuj0MqB9bS7m3NftyFplOKLXK8trzbdhiuS6PRZDfWzLhk/6LEv0e22ZTf3fl/pQjw/Fbdnfm2GUEivLEv3eFOe6NUPV1+exaLqqbIpT2d+Zkf/APE1yfPK4OFRlUd6bvjxOMTMnCueXJdFu//T8vppj3ebrjHPf/ZepxqK7N/19bcj8OkkUBBioM45mHF2Ay340h6Lq2pv6eOlLW7YYM4EJ1CPDwzCaU1H21W09mmq89Ab5Sp4I1DFNcypuut5U5TAWpj3WrSma7lhXjCnDAuqdlXeuz6axzO4y2j8ZR4aF1D+H+3ro+sGVcZfzi0M5lowjwwJqoYlyY8bq1uaJqnR/Tv9hf2J8RS5QJ3VNU57KoupO58bY/McZUnCgHlpryqWSvjFfi6ePn75ka4jZE6EDNZOrpYujaY0rZ8Vg2rG2VsWpPJ8z9bALBMYXQ/GkOHdDPZGb+sZUD7YCNN/rUSpFElN0flp8Lau70QxjceoOl8YUN315MmidhfHFUDyzKddfyv7BJV9VDqYYxsvhoTib/qbrT2VbMUUbFBDD8Xz7mrt6dJ9iuyiMc44ier1YiTYLm++mukzJ2Jtz1+da/9lU5IruL5d8O4zlaIrTVEFwMUwTRJ9XRVPfm7WknroDZ0KgRYfXRV8Pd8WpbMujsWqMfoIV1d8EfUjbPT7Vf7hi/q1s7uje+uwmciX3p48L8726LdujKep2NMe5gnEljamPBaLo+6Soqu/jplEeyvPIfWuOITo9LYaH09euQSucDEH0eVYcm24Yyp5pUTyQ3MesmvrPvSkPJzI/V01duF+lkB3Mqct0VZcyzvhY9lYBYY5LGkmya1pisrbkSpJT6cbk/OIiyQZFC5O3Q5lxkIQdipX8Z5CWto7MDzy4rrjjFh4KGGncGdvnKW13nawNFtEQCQwk6nYYy6ZxMVq2h2Iw4+XMWeQ4wOjhvy91defGPMXxUtMtxOJDwIHhQtX1U5+kMmd6lLvIR1BgXLC1vra5YsUTMDAImFvdrXOHZCKGBvT8bR++a23/tTfHemrAMnXy4pfjIEMAczp3fdkU9dB5ecfO1P3kZurOvbm3PWo+CDolYFzgj4UZ4wgJdPWb8sH0RW+Gc9cO9de6qceazTdZDtC7P5izaQ+mrR6KurUTGdMAZRrtc44sEejOV11r/2FnT87lUco/NAHorU/JCXxOiAS65ufL16auivJsm/Eb05vM8GMxoBlALzzoxRQ3l7bKDrUXrywJ6IzTxRTzldlAX33tq5TnmjMLkUA3PRg4COIpGuiJuy67IB3ggG722fRDPYw2sxSXUa4KchSgn71255DEJvFAJ9sVs2YKn+lZhwQsyj/3MuBQ3ZoTvd6zGBBw0eLFNl4DHFK0aPByi1fAIEWLBq/mCRhAPYKK0vPoGVAOkaLwm2Ko/5gm8mTpGCuJP1tLpCyeYEXxJ8vYA9Mn4KLF06JqapuHazuzavVKqfRmOaLZs5nITb8uJjFWFH8+E5Y8zYnHWFH8xUyYsjSnHABF2Zcz2uZnTtXHiaKvlpibcjInGyJF4dcz/GwX0cqGU46govSbGb9mYE48AUvyzx8Xgx2fVMZ1dRnxGCpKP1nx8LrYYiVQReuntqvWLp1nJ8UVXJog2jybKxPIIgGL8s+L+7KpDyX8FSRBtHlhZ9++2hlmwCIBi/Iv3YoIpB5jRfFX09LeofuGRRABFy1eJ2N6ziFFiwZvghl+NvwRVJJ+Qa2S2bH5lk0YN4AtBuDJlOnt5PeB28yxOBJw0eLpEkqvg855UHjR5FlxbpuiKpvq0ojxloBF+ef+uhInHQBF2W25ypsAy+0UWiyyJNHuZWGXX13fdssynBfNEI1eFTflMP500/Xfyt7mlBOQKlmSaPc6GLZyHiFSFJ7Hw3jakATJ5uXjourL4bboTWVbUK5zmWBF8Sd2lr75yaZjceraeux6PpIyDNHo6bSi1t+XTTHe9t1o94+wPiRBtHm2DEVyS6aLfAAUZZ8vaDixcxTRyhsd24F42dcDWzJogmjzcgmeW/zm6vUEK4q/QhaXF/UELMrP4+Rz393UmQXdRTyCitJvHB5qYVOwJP/q8bbvZOzL6o4vAxRctHiybWeYmvuyLZuHsa64aMqTRLunW5/MSWBtB8sTTZ/521OKkxl74ftIgmjzfOqo1YONCLD3kOWIZi+KeUzpMqvdiTQMUC7hmaLxy+LWlOOpPGNZhYCLFq/kfQqL/CvdDoVXr5cRDexAM0SjN/7o7FzaTs/Iz9XmKJLV68e2X2WLImRDwUWLJ0XVd8PwU3VxW2enlduenR7LckSzp3Zc6DYjS2tOCVYUf1aYvu/64rZsD0KfIsGK4s+DdQNpjoWCixYv7GZXWy0dirE784UvBYvyL4vqMozdidzZxFmxRNH21cL2I8SOTEx7YL+QJYq2rxd21DCzllmSaPemOF2asf5p3ls198P4tag8SbJ787go65/O3TfT2wE2tUOO8QXYYgD8iXhwoT/LEc2eThu+i6prmnlmb9l+ztnlWaLhs2lrPVY8UrAo/9zvpx/AMTbDEg1f2D5A3dq69H4olm2vvS3LXAZlecBuri5ThXWZ2ore91U15TBk9oS9nRL253Kgc0Jne16WXmxAKbIc8t06i/zFzS9C+gkLNeuNzmbFYwaf+u47PVsQS09ITPTLNAuuCXfAwEz+vtbBGqOEJZn9PM+UvetOp7I9YF40CbX6aCfIP/X1fTmCic8wdabTTps9nj4Rtfx1Htzp/CIWavZ5GkDqrAIOavT/xjozA54aTFhRuDflnd3Qoa158kTY8t+mUZDSLiDBVsrckKHBdqr8QJJgKyhHBGBZursz/dv80YFA2cNiwkCruQElyXdldWuQKNiAouS0Au4qdEnUg2Kyv3BbKGLhX8A9FA79IbuBItb9gOygcNDPue0TseZnYP+EQ37Jb56IRb9Auyfedc3lpG6xMyzZzE7Z6M1IFmA2jGUL1foBVhJ+fzmdsQLuISXRJbtqW5IsDzdE+7EEAzXRdDtJDmqEJHaARYW1mTbLkwyn+kWbC2gSaIWmfwyH5DUpnxIgC23S0CTJ6q+mVHaLCQZioun+JHjEACkjK04UrI+3Zhg/TUsXyvhhqCpbVYxliSpLKA4TgmRxNS+ZI+oBVhL+WN8b1TA5JSAW+uFxhoWbKYbFNAmx0uVrgoGYaHJxgkcMkFy14kTB7oj1gTYgIHk0PRgBPlYSXhIDC3CERsU/1I0BRmcxHJbvmgM0/EsJqAWSPwIsKvyPvh7RMTHJkY2+v+/Lb5anK6p5osJSU3BzNIUdlkwhXJQ3p65/AFPIx2LCy6SaxiDiYEa2+tKYeHjJ4LdurG/qauoyYhYEQ2OiizSGqTH9q2nOaB2c5WkM8RTLsCSzT25zjXZElaOBdprZWYoC2uhqO5oEWmlqOYoC2iC1mw8VZfmblHxV/MokD6pMgSxRYalKiQwNsLPbN4D+hodERTWz7yQHNHpn9wlB3d6UAFpoRmwUBbT52B0VDgsaFP/VlMOl18STz4BNbHur8lgJoIXfQCiMEhpop6mwUgZo8tlUBpvCTgmoRT3caQwWOCj/ZT5TpLAIKKiNGQZduvsM1GQ6u6Tx2AiohT1bpnFY8bBB15fYRDnBEE3mDe+S8gxD5b7Uf2AhjvGiQV9X5lczgjPUMVySd6UR698GWExYN0QgOZgR3ktP8LLBjd3qh6SuD5VlbW8HDbOHxYSBjtEGxCSxGFiRmKhm6oVgiCb1cKcdWZEcxEgzpkrwiIGuL08wEBNN7z3BIwaaFbcEjxhAGRXtJVigdgGP5EhGS6dCl8gZFmqmSWySgxohaaLqVs29I6zmCMGgtK7xokmgFd58pQTRYtpmo60EMyzMTFMREgzMRFONEAzMRFvyMyzRzHaSwQzgQSFZZTYmKJCNIgtHcFl+6t6j4j4YlNZGEUUCrTTRFBNkC3eSQ13WczzcEN2iQzBQE2W7SLNQM1W7SHFQI1UtRnFQI6gB9rGosLqKzPFEw4e2UmaClIGYqBI/xiMGUFosOFnQnmPFJFekJHpdnxSzDhFaEv/HdNuDarsPRcFs9Ft+sjyNoWLbT46G2elKBMnBjDSlgmBgJprqkGBgJkhZ8ZCYqLYazLBoM/8A5HLxa+bwYnk4+OfisqFYZIqIIH1teTiEG6Ahh5ACeHhbbSEDDw+ob9MKkPgGB7T9sQak7hMQ/aAXgDkEFMDDL1qQg0+Q9KtbU925lcx8KVzFfbSo3J1O9XRiZ6q1l8viABOaCPpNb+GZny/5w7Cx0crAHNbFZdRgJWD67+zye6OOr4gGejXdYD6ZNntZGmXkcTCXeSXzYzcgWSymqD3edQN9BxXvY2kqL7dVW+nkSDt8dnzVRsT83PrjtMINlx6fg7lc92Vt72P5Mnb0aymEi8/Ru2iiLubp3K7Lu3xXI+NkOXqXPd+08ES33tiKd0rZaX4IMIopksfBHnY72iXMdvjGTL+sDhEB0f/F3v+DKU9QRPNvuQv6Esm/ATfzWdxnU3U9UM1vWET1uvyauf02EZ2gkKb9KyZpvou5bNppNk5r5LKoB8Z0/+NStmM9AvVYiJfUj2bU9egjAqJ/PPbmWI7mcG0fsAbaTIKE+LiOD5gCEQHQX+Zkr5d7YyGThIU44V0yHw0owz3jDYuoTl0oON43OKI9HbYGQ+ywkKo9VQ2KWiimOUI1yoYFVN9D7dUMRPTMTXlpVNEaUjQecCQHDMBBO0uQUAAP1SxBiAfUP9pb1OfuJiTvEwB97xDM+9oe76/Mp7bBulksfbf3J9Pb3VElc4WFHIJNBAlH3V5GM3yp28r40fdu6t0BfRRZAwlF7jbnxAq4zfloxt/Md1U97uEB9d97e3Cu6/J3d/jaKxpQnsfYiiwfMBCHeQPkNNdi5pTDnCimwvFdd2nH6SDdDtOYrPBdz+/tsI24Ctdfbm7MFFF4m09TNZ72oR3lF84cpcvD7/emb0pgMJ8havyGsT6V4668GnEVrvPZfK+G1TQNosqPhkTZUIBa+lD9QKTsjokf/vwf/eZpjk03AOEl9oZhT68FEfoXhOcHUygvtzdse6oPSmCvv74dSOl7ve3AehjLk66+piUUYbhq780wmoM6b/rEXX6XzJMUsuFFfp/C430094ZZyqasHEXh4V9BsCMPp/R93nvqmB9q9/4lDd6/oKXzJdRlOCbv891XfikBhf+8orSnpxdS9Z66HL6QND47MrM+B285Tms00xRe/yhre433nhoipAKen8tvmsH1Bke0FTtDAjigva6UK8bXEQdxcScE3pcj9gkeHlHXLNGFeEhds3cmIiD6yr0zCQXxmN5dwLQnKKCpq4A1te11N5ZTvTLN+GPzbREHdZkrFa1RQAO8dHuXIoKkf1sOv3XKWbKUA7moawuKBThNi3fwwkhEkPTdM/Juyu4TtOMnZmgdfucuUsm6/A5cquI4y2Lhp7479gbZXkTzQLdliP72vqwbbIE9x9zrqIlRmo05v+/a9VAN6udz9C6aL4t5uJs9waNxsXiduvY7Fg7u4upIjYdjaB20X7KxMCdwf44HBnW/I9vyNiymGsyAoPIBaYePJgkSIuZ3dWhUrcGC16lrPsTnYC7e6BY18ShqD83HRDTMy9uWqm5rKO5+V82n5vgqd5d99351xP4R5x1fTiiAIQDunYst8QvoHIF9XyISR56Y2JCamFrwmPrSgdbUTz5H76L5lpgHuoEjCB+tUdb22kLWHidVnCVMjaOm97YxtA7679H14XT77FOO3kX/RRtP46b3UTisp9XtnnbYJWDtcVJ9U8IEHR/aCvZ4aCtcVRX6GY+p/51/Np3Q/zv8drrD68Y5mjHOeoL53Bhk7pRiaZw0qaAdRTm8dgYkZCFO2i2kKQdxUW0ijQiIvrsoFJN2WERVs1AR4hF13UR8zIAclFPxKQdx0U0GxwzJobs3fV8fjO54BsVCnbQlguahbqqSQZBQH01eTjmoiy5PUyzYSZm3aR7qpsvjFEty6k15QGuxDSurnrp7g+tuaFH50l61v3bVHbysETMkh8HYt8bRsPtoWRk/+DHA52kG/DzNgJ6nGczoXrmBNB0U0FStXw+q9etBuX49qNavh9vLiE0HLkhRcezOS50AqHpoSfne9YuBOFiQkuK3sj/BuzI8sKhrr3tFC5oHpnX9i1Rqe8/9TTl1k3PPwAfXQQjDwFWvyDClT83Q/Pvf95v7KlBApjkmWx32ZQV/dEASbdZrMPCYjShaC21cMnTJeplwsnVHPYx1NdjDQ/lZuM01wxQNk7VX5dfyArA9nJgRQ2mw9+N2pKT3GDpaGhIObPLLPbdhj3CYCLD8juyYoUqW0fUwcLYgebvMlFlE1BAD4d1Tg39uQtLbaD+UFRDtpy4nmns8tCjc12Ndlc207q79pBxXMrW7CBTl2odL0vaN2lN51pc4mija+Yvxik8ieSoztMpKSSqbHRHJ0CXrKzc/A7jMSFDwXdk0X8vqLt9NTpRXCmjxqezLk0Lf4UFxYaIhEcemGBawNNpJ5cERz1WmX/y5+4aa0WzZOLwnhR3Y+o4pTbaK+qvox6U00ern+oB+yQyVJcUjjb4oenjxKur5gXGSsnAjOGJ8AiDfcWtTgW4HrEtdvSurWzMPw/EqI2UBRhaNxsqGloW9yyEVX5CwZKMlE7Dv6vgePkGUn3efKRrtmCJavL+cztJ0qCfvwSHpq9adlUW1F7wo/gt/p5Yn+wt0m9bVshQCSc5YWFTVuCck2AbP6yEDNsAbed3K0tUv3011mfo0eF6MOaLJB/bqL0/5A3Lbl0OpUjZkYAZ4mnpwTBpPTcXi3dU8SgHb0w0tCn/s8ssUnuLHTlyisJjp2g9Qb8IiotyqRygJLHpcLfex24rx97PN6VA+IGiw1XXZHw1U+kKGbDDNvmuag5ABGIy33UFRfQQEUb696fbMP5A80cwH4ymSslRG/PX3GR/oJvyr9a4ptK8XEET5T2U/mLf9UdHXiyi4xWczXBooOSIKYmF3boPSFopKorHuwVFpd121YvxE8VCzZSpKbxcxZUPgGXHfBX9L/Go53j7fQvCxPBywRoMkwnb2Zdm3158VJYQiquw+1N/NYbvbYp81KaIKxr+bpnnYZ+5RZcvpjRbdkDbmgCZu8wFaAkKKaIG83O3JK97tvnIPvyh7MwkJtMHbTR8vi3NnV3xR4NzKBJrXx6X3pyPpkAUZqUYqAQGTt7MntrmD5RcCJI8X4A0NCX82/+Uet8NbdoIGWeHjLXwXo4NqKoSAAMkD++sjfXx/fQT/sMPig9bkU/nQdGX+roms00yU7S6aeYwNLQpH1zi4lWkw3XNcrek+O8jIbdnTDBIjimwxBeb92EHiCxiUvbLUe6W8RwJt0ATA433ay4xp/gGcZZxh78qmujTlOHfa3l5/xi1S7j5TtAefJe+zjXqtu0MQ6ewLzNSL3R2EiY0b412MiAJa7MhL2iz0g0n4Iym3K8H06eS6FqpIXCkqC13x2zgqk90pRdJV1sqU8kiyjd1brmoKfQImj3eqPTggPb1QvbY/cCYgeGoz163hXqtjHFey3pa/vYzzhC4wS2i/n027z9Ax1YbyM4CMJ/wY4MKE5x98PCCObyOCNxCtJ61VjV9Mgm0+tR81Bp/aj7A0PgIOGbABPgDWHXlb4dd1defC5CZINFYxd4epsvLJ0vdYKyogmrvD1O422WdpmTsMNbUezd1hqqz5svQd1vMduPuMZ7JoGz40qVhcIYmwnXsDcoddQBTt5qsSNJVzRAEtXKQrDGYCKI/XnZojvAtY3QJQPMnM3k2j36xNsCQj76Yzxd45gqUwQje7xxSFhT7u8mTR1gxDeTSwkQeXpce+rmx4kMLioSXhebEXTQkfDkoHF8opt4JIEoogwIeIEo7aZP9H6k8QBWS42BIs0Ci6JG/fpzIiqmBo09Rn7TD6kY/dnbLqM0gkDzTT15Y0UbTbrj/UfFnKUhjt+LYsWbSdb2Zajh9rPjJDRS2Xa67UhiFRsptWo3ETH45Io+3RikVE1/VnZUHOchFTfbYjWJLROl5C4y0koPLKgxUUDbXSR1uGKRryF3p6+tBdng71f57AgsUTUPIpLvkUk1znTpTlgWGDxnbyRJORUpbCaOfnJVTQcmrowfn7mIJZ2G1vihxm4Wgus3uv1Qnjk3CbXakSEzE7O42l/iqfhNvszG0pFbNc6/FdriQbNH5oK1UmXwi4/FQC930XxcaNbWLs9o3Jou08HQS33D4eFd/RmtJM0fChreAvWbCI6I4vSFmSkZ0HRkO/YkXRZMYXUU9IehtlFuYFUPttollhuZH0Nju/khaQ7OdtjQbcs+vDQWn70vWOM1MMWzIO70VWNJM0EbVT22jk9bUFyUPNurP6e3wSbePfrzc+nLmr9br2N+6UrmUXG076KjZzOy0gP2M3OExyqrsb3IUM2zUb0sbk2YEkYV5r8BRWMQdz8qZlFV4pS+U2P0qt9gt4mKM3slL4pSyNm+2Pqc08EublN54KN4Km87PN2A4/jyb6Xao7M8r1y4aTFKdbTz7Ujfkw3zXKCydwWP/fzYNcl8VoWV08rTbroifUHHLZ046oLlhRebowTrit2Ol6SExVilbsMuUZxsxm+GryLMail58sC/TEibJF7xmm9wzVe47pPUf1XmB6L1C9l5jeS1TvFab3CtV7jem9RvXeYHpvUD2pcpj15Lph1vuK6X2V9eyQB2oxAqik+74ezuVY3fKSCwpVk6qFBSfXC+/77vyh7pl3tZzgAoP1xCAuQDmM7tKlKyFZFpSsdjlJSpeTqDJfSSS3/z5SUp2uxsEavAAK6cpBXWGiHtRBQfslC07KMgtOzjGrotDcrYpie/dvZrrb0zBnSifFDScqNt1Xu8Qh90F8pLgHb1ke/9gd6+pT7y6UNP19zRz8mFw4pugq7710HvhWS7tTT/8NGZbotpybFHuvPhJVxbv0FEPjAnXsCYLo4S5+EG6rdeo+VN6lTJ0SFAxIDuikMFDpChtqfV34FEJ46kXSjuDw/vCl1Au7dRcXirRjLzrosxHAvcf6GiPLEzcgd0e5uphB8r5cd/+Z3ET7SHlvbDlcemBI7gFlTXuRGiK54MDNwZ875vjHLLkCQc3rrmvszntIdwFL2v4SghwPMVqjzk/RJ/LQzPxvUuf3N7nvi9wENmkp7gBb5mrNvfTJPlKxy9Ft/b526wWcPEURfdrGjTQF7QUm7o+bLkKSI3jDyYr2XiK5ftlwsuIwdr350pbn4bYTavQIjOwPBL5+RiFqv5ZnWezX8oxoAbE4o1SbL2XJFYpuFpTj0EeKqtMTc1/MaE+CCZ2oECsry++xzbLwQ2xfwBHbF3jEtu0aExRXHLrpCxnwh1hM2W8eoLmtLA3cJGQj8vpylpryGK3Y+yStJ/v6Hl52sH1zuWRvOHmLUTkiBXCByXpTDx9RXIGgpjS1tsLQbVVu9Cc3tikedZhvnDLlIFWcFAN2sWurKpONAHsAHYcQiyvbyRawxJAc1AkoNx4S2dYG56AAK+6SQmYwrrG5ixkmTVrOMHnOcga+G7v8Da6+ogWCmsjsxLXmJZ3r3bOMHFPp6u4i3WHqE2VP8cGY2QJ9K+ba7TgA0nkDipr+cxeAcgwX9cUHLZwu+pbFNfgGRKgK5s34KQcsi2RYohv/DoTThp6AuEaeUfD0wNjYNY+eYyncFKWTJsle3RHI6jNKVFsm1ti9+07Sh6p0geDGcFkfewthVlc9gxDBkdAnBNEjeQAAsCE5opN0J77TBq/Dv0ZudZ8V8QvdfSwQDxFaVPfu1wbUIzSgbqeOgAjZgApNKMA+WNbmbt+eFYGLtyeQ2Au0IKAPCNzsvOmBLcA8Z/L2UJ5H5nUApxuCUW1FFUEwZBf+TtlZGLpOdoaJ6eVgQIrh63/XmvW/62leAEwzD4rpatIrxgMO2y16kEEIB/SFi/cWXezOvRUo54kZiOQK7JK6UBfMGTtXOvM8laOiX5ejgX5Q3Gnup3JYt6rDy/pITFWeAdlwtOI/g4Mt5nt5ctOo1NmWx0+Ko5taL4ax7Ef6OrlZo0jR0jc9flrcTHvzvs4DZ1Y+Bovqz4pLezC9rVMOU6im6VpyRWE1yXBEr+dFU9+bYuzLQ6YNWS1CqKj8ouhto34q2/JoTpnDkat4ghb1XxZlXXTnsT7Vf2SPu636CVrUf1U0zQmKmACZy72b8rms7sqjGTKZ96bv2vHPvSkPdJFZ6MUELBxQ+ppjX55vEdEJCIp2TVOeSkTVIUHZc92acUBkHRKUHeqDuaurO0R4wcLSU2HDlCcoKxxkFtcUZfJK1ZTDYMiaYSYWM0T6hJt5Ox2rtYIktfXUIiu3oeR4sG2EJ3bq7Krs8Ofpv0P2U+68Yzj8muNmVtkQoeCTp/6nZV4h30S3r/J0CUYU6hcvZRP6cC9qmD/cS5hn7uyhvZibekLp8nCgp9zXnDXLRsBQ8+XzUDI3W0qIcnOlsSw54UhoZqcbY0Fq9Ero5causRw9tCIE8wOrRDLTL6dEmV55LEt3WAnRfHc1lGzqY3vdpRsDEskQyEhuZ3zl8hxB2bIUYdESzNA4u5+T/uh92df2rsRF+WeyE/rsKSGSPQyfBDfDYEOarhslQaWXjMKwLhjhZsk0yCwRCrmYUSKkQlT7EcpcstHE+j3BQsLhLoxJKdZL9188ffzm1ZMXZOpGl6vkQ0ncrJIJoiJ3Zyi8jV2b5PK2/Z3N2MJ1BWGkAtcUUNE7XTnAdIk2BNclkq47SIPKX3OQCyl3zUHqIV1vILhkrjfI+jDXGuScuGsNUh/pOgPehbzOIGeSvcYg58FeY5C6iNcXSD7k9QV5n+y1BanPdKw/X26nn5li63ZR4WMDEs9VLCQBbC5ErmCc3F/gx3ju3gIqiul7C1I1ut+WKlb2eVNHGfKdQR/F9ARdCTPTNJqcfgmYjcMEjaYcS2QtyascgqjOXuFAJN2ElRpMD8UFrZo+JBmsMglIE5i0nBlrwyhqr0hRlOjA0pqZbiwhGZVPSTiCy/JeJhK1Pawo7LW0kq4H1ci+6/wxjSht4ai8a7dBcQfWSSvCvhG4+om+iiEs0tkrGIjKcwJ7O9vFUuJjxbjw23pJ2MeqhJE4jvGwge09oOIWqxLWhHzBs5ljWopmJgAWBNOJqXpj69ftEAITwBjKha2vx7oqG+aewrQpyXG4huV91xL3ESbaPoyVu5zO+fi0vzJxebiczm+Pph3ftsM3f0QYx2QEZOLRIqf44MUmiCDzt2DnPqXyt2Sr/svnf3KjRKthzr2pSrvAGil/NlXXM03YhhGCeG0jm9eZIJKM+c6UswXBiJhTPY6mz65BLL+HEs/pxYhynTX/cvlqD63l89eqm3CYXLcsNS+dAzugw50YNue5TpPgRhGFK0dda9ZpRtiAYAke0wtYKn2PIWjPs9sq9YDD6Btb2n9xTEDah3Oq3+tRIbqhGc3b+nhrhtH1dfDIoGiMS31olOUrYjDaJ++lL1g+JTEO560vizukJNlBmwoUjXPZTovj2SglcQ7RszcKG5oJeLkyqXcKeIyP3QmDJ4mHZjQH700VXJtgcR63l3F6aw+OmYjBaU9dTH0qkzzRR6uP6tq2QqvtcUR9NyZTpG/K4jyCQ5AKF4rH+dgb+HH1Dc1o3q8XnePKCYfR/xZcao57kDzRB89D38A659t6u7g27B4n0fd38KTXFPpTFvT1hOlsRXrSLg4efcjuWSgiHIFLNYHTb4HF1IKNn/pANh52eCBm5OFQ/3EppyiS1BYcI5i5RtFPDub6xDRNjoYZWh0NN6o6mhHbEBQBBcnjsTdHOyy97ssDtyZAgAVpN0MsJGwE5CWXxum6Ppmb8LgkoZugBXF5mtpH8WLiEsuGEYSm6WUxDjeYIBffLE1pURdLp0LhOgmpky6UEDIjO9+wYXih9+zk2wwQJMxNad+dB6IohIKyYoQFSF70l5sb42Y5bJrbaQdWOYUL8uA+wQTKy0L7BEMcL/ixnOYrogcGCUUfyEt6j1O/r91hpem2LW7ymaXtsftkentksjzyeVoiC9Z1exnN8KVuK+PHz7tpppqZkZS5gnF3EL6rOwhh/818h+pYD8cL/t4fTP9z192xciuKF5uXA4F8GSAF0W6oLdvtI54TgBenGJjJu+7STuNNjU9MwqyWHKxxijiYUVgJQj4hBbRpx74Gv2PG4sIPv9+bvimZ9cEMAbQYxvpUjqrcFXEwo7+6OUqvAkMqWZH9A+ZglQtqqAKy49P3fO/uj/yBL5tmP7GeNU/dYatpvhGBHwvCzqjPy+wIjqZYU8Qdlnhdm9J22Nmx3jCWJ6yCpKmY7VV7b4bR7g0Es5ZP0FpcWq3HJd63kDOZrr/FsoSDYrJexajJdSlNbacp7ntbkB9qOn6szfDZcNmKSWorXbmiiJjlvL1L08sJKSobLE8uYFBakf1UeW7LK6j2DMfk/1HW9mC/prCGFN7mc/kNGa9tMEEOOCAYwHi5dWsoMGSLsIIwdR8xJZq7jjgRRPaahTjtpqSJjRyYjIBCwMEDkwlUkH04fe2EBJsgvAxWv4GV2XU3zsdP+EkUD4cIdsMIi65YQHiuJlDtAM7LY6dZIyAjSb905K/G5F84Shdjbsvhtw6cqkmxTDAnMFylUGhefFp9EWfOIyAj+VdTMouY9ldm+c7+fCrP+CFBmsBtKw266UxAfRgXYh8H7H4l8XB4pQOZKRiWVsQ5Q+Psruglx0T/Kr/iSAgSNy4E7xLR8jSLNwsXLMNWmHBJ4az8z/VBkpwhvEx4NlmIihQtiIfHaynB9IBtJEKdaEuFsufaIrH0K/0aPPeyW1p/X83bEIEiHEPZANp96kntmkp6MFEuvVWV1qMvVI0Ec4tzqSS3NheJkktzqWJ2ZS6Smyt5IS9vKFbsY3fkVD52cVOf0KeZcEFjwkhCR74sOQQrstzLa5P79/MYXiSUKhJwXj5ziy+hzFzhG4m2N53mKAqJZw2Se3g59QTMhz3evBN3G+i9O0GPgX7VMai1sq85pvVW7U0EXnfimJ6EM725q3WRUqqwAyAbicGJQaCRovCIwdLHwi0iBm9C3bRMKOeuWY7l5mmQL/Uf5u315/hFSEKYIsAWH+rv5rDNFursSDJs/e+maR50hh6FtyHfAw2KVv4dUKJP4MBYhyXGAgElXtHM6WZe0IxkvbuxOUkPJsjZm6vBtiUB89L1cDffYTanM6udoEXxd/bWgfDVWVp3BYqScocmN0NIiSFpHwBFyb+v+6YlzQ2pEP2gkI1fLWOFkzPVkjp9wjq0iOZA5meW+OjOcTRGOgtRPLyWnFUOobysewpu7FjBBQRIrT0WRNIDA9JShGLxyD/oHLQQwEPORFNBst5ef+bDTnP0nxK1yGrTiK8PwNRCq20nFmAGpJcqmRSpo0mUnWmxNwlUMa+L8LipIyKcbOdyEe7AUISvUDiY6ggnabAdGOEemJf2XzJgZX2gIJl7pD1MR/ZxdiotvTcR+JBuOCGgbm3uU/uR11thkFz8mHtekXrFPSMq9/64lcaMKPX0fJRG/JPzZCrFFNd1RoIec5Qf4XpMwR1KiNdK09pFi4yQF7HSKBrZGV+djWUoTexBCu3XOI7SiLjpCvHK3Hgl2s0bO3RmM4m1Cm8WAmZ5SAJk4a4AUlgEBNbCrVa7r2Zr1QAISMoVVn6hnBaEq1cKzxk09df8lGpTf2VmU5t6GE27XYeen/qMkcysZwz9veW2xlFoUXw5T/hpvqRAko/xskFy07JokTB2mCBRRbNEs/ferTKShY9VCSPhj/GQwcegCc4Lf0yaXUYQDe2ChYRd6UVkHVIhioZ3Q4viwpVcHkiW+s7dSLhhRKHMHhNakdlpIkkj0ZkQRItlfVtSXnCwIBJcHysKe1uDJV0PqpFFghzBRXlvPQuumynOLiPkg3I81NDlNe23RaydZorvI5iy6XZJkuiyQUXZ8NFPWi999TMjhETBghMFv3hXEUmiPlYljIQ4xssGwlZJHwWKob2PEK0UhyIjYYAmSC9kQypE8VDDfRHsbtwUqxLGw73hQQNcGhMNrnMShQO0UhwKecKQTR7aSpR9aCtICArjjBMFqaVTWjK3dEqIYv1osA/9j+DCKkx0QYPiSIwqOuYOio5vQ7Qgjt4okmIFYehOkQgoSLqdcbyawwhCyCmlECcIYudyYqQkCp7MSbGCMHb8I0YyomFTGM86pc1fMO003T4L75gn0Nx0WLBFNQlYvEE1DFd3zO8rnH+UVhCWXaL5MCwIJiAL5EPdGO6poxgXSoYPHq3YrjnwDyilSEQ3fC3ZjzkfgUbfP/qavSswxLFRSYxyU7XM+DYnBWx0J9BctvXg0jmVGArK4iUuT2KtTDlceua1HQ8gZoOo3k8SjKjzn6UC8tOCIQ4WfHsoz0H+jEoQBWYL0UTgom75HYs5vnreMOIHWxD0sR6Q/9BhKI9GzIEejM9zE+5z1+Tqng0gx9wEve665l3ZNKzeApI1x9vugN7YSaHZFLJv2dsSyi19eSguJukDBXEI88cIgpD5MLkMUmhQPF9iYpSUUj6eLz0xEgxqlOVzYaWyfBLY7t70fX0w2DWkFJrp2i1wdJxA4wEDaLxAgAFppLufYgFhrNtPoRFxsPtP4wEDbBhAoRnxc9kPJtwsHiuuEEZmnlfOl7sZwBS3GZGvFDyAVMRmqNQX82Fc9UqtCoBnuCQqaCs+C5hgVcL6j9G9CRgQxc43gQbEozUN3ScxZNgaTSMfrRTf81G7Ugo+1E/iAQN8PEMTOIuz29n6vr65YWq1DcRVjw513U2b5/gLiVKsLPz3srkwM48+iqt9qaW5sJ+fXZILe/geDEn8FM0m/QZ3/drrh3Om509CxVp/IymyV5YkfEp6BDKJcfr4YxLjE2zdGBSP15KWlCZwLatjuAN6qH6AlsWXky2ofISXDT52R1R7g8qy87QGKh3CEXk7vMbVPbQs7tfpqAXBkY3mKhj1COGyvDuUiaoHaEDcHqBEpTesLLysyqPiER4wcMfaYP0ADshP66+wuo8GxO2JDVjbAyPS0xELXNyHc/LJadyoPifP30aVuXdymwmZh+ICFD0XhjTIGQrblAVvhSlMQgJn0ZvyIC0Gbhimo+PKfj5m3e9MnDqAPKsV4kTB/KB1+13qvTgkP3u1Ydgg3TTsc0ozgJHozam7N3KSbSg20ezxeC449nf2gyyA62ttCK50OlR+qWv7XU4ri5SWuXwU93nBDrhEJNn7lpCBMuvDuJJqcUxmnn8Vo6ce7qS5lxUjBeezsQ991V0LDn6zHMkIHzMQaLb66y7twR7wYSbZNgxTkvpLe9X+2lV34qWFMZIRXfol+Sy4IJhsuEDyecdHSPlnPW8lZaIQyKWBv4cSKC8UHJHH81CGwZkMpuyrW6lW9lFcsrvuIpPqDsAlukPIrWkElCWZbJS74JfIRQ7Kt6geiAnWwL03N7DvzQ3AY2ED8ljYID8WNgCPhQ1mjO9fI2SoC9hiGehO5gG9k3kA72QefuhO5uX5V0Z/RnBFx7sjpTEHsF1iWGzN4mhuSlGut1I0KK78jIQi2zCFev1dLNPzNSo3HRwZPlgOpEWrYiImIBbcO5ghBosPexYajg8fLAfWHbNWxUhKkW3WhlzlRLIAs4e2mjKwzoxigWZJ2qQp7uOwVJ+2eJ8N2i/Ok9g+x3JP+Zfb+sbem8i/lUHCuVq/mRDrfYwTjZVP4VxNHbYlSeOfNiFhb8T+DnRvfBgqJ+zLorDc2HbCMzXs8rOYtSxQ6DItEOlTge1nMY77xME++zxvmmCyiIdic8Y0Lch95QRgv3FCIPkjAMqSXDquADklJ6iUliuIDVYc66kOFeOkiNvIlF/6S3Hyl87ncdytdaYccndgUkhY3db9kPgGhLWnNXqhmSCxqIM4kvZxbKu2bFvCR7o0gzUJjkslmS05KBVmtIe2Ej93wUihUHxmiubFh9GcuI+0vzOfee0unH83+ncA+BnGA0i55Nq/NJ1RjGGibl2JE4Erhout64/dkQnX/KsYnOXgQTiXHEj5EFkvuPubCWAKFLWT67kZeRIrOYyd27Vj91kFt1fGTWoEZFrVa3JfRBDU/K3QaRR4WObjI5T42WdVj5aEM1EwnlU9WhLOxXBykRNXtBIwW8YSNDiy4ImI5XZnFGCzgXXSyq+hiayld7s0k18jlFgKqOWvSJBe/SK0oqtymVASSFndv6eR045xgPJ2ryIrHMIk3Xt3pJkp/guCKZILxGaWTrx7gUJrZzEXDfDRLRK+1xN+jytD2O2L2km3WmzH2DVvcTAsrkr4Vtbjh653m+nygQ9gTNjjc/Vxp5E6UR90GsPT8cCcIU3gPhneR4LvH3FItxGULvk+Qir088kIYk46E8Ts9DQRSHy8QOL5vNSfxLc/PRCTj77ZPQnSQqIHSqT++b///P+G9Zmw"
|
|
|
|
| 1 |
+
window.navigationData = "eJytfdmS3DiS7b/I7mPXbe1Lv6mk0nT2qKo0Ut7uh7E2GsVARnKSQcaQjJSyxubfr4HggsXhfpzqJy1xFgAEQayO//yfR6P5Pj76y6OyH+uqMY/+9Ki6rZtDb9pHf/nP9dfHT4qm6+6K8taUh+JrXQ6P/vToXI63j/7y6NBVl5Npx+HPs0aRov/v7XhqHv3p0V3dHh795fWz169fPn79v3/a9J8Wg6m69lB0/cH0RXVbdrwFRRBdnhVVU14Ophj78mB61iDCitrPi+481l1b3JrDsW6PrHgMFtVfFGVdDGNfjub4UHzr+rubpvvGetAU0ellQPvaXMy5r9uRtcpwRK9Xlteab8NUyHV7LIb62JYN/+izLNHvtWU29X9f6kM9PhS3ZX9vhlF6WFmW6PemONetGaq+Po9F01VlU5zK/s6MfAbzNMnxyePiUJVFeW/68jiVzPxQOL8siXb7p+f31RzrNt9mnPvuv0w1Ft296e9rQ9bXSaIgwECbcTTj6BJc9qM5FFXX3tTHS1/ad4sxE5hAOzI8DKM5FWVf3dajqcZLb5Bc8kSgjWmaU3HT9aYqh7Ew7bFuTdF0x7piTBkW0O6svHN9No1ldpfR/sk4Miyk/Tnc10PXD+4ddzW/OJRjyTgyLKAVmig3ZqxubZ2oSvfn9B/2J8ZX5AJtUtc05aksqu50boytf5whBQfaobWlXBrpG/O1ePr46Uu2hZg9ETrQMrlWujia1rj3rBhMO9bWqjiV53OmHXaJwPhiKp4U526oJ3JT35jqwTaA5ns9Sm+RxBSdnxZfy+puNMNYnLrDpTHFTV+eDNpmYXwxFc/sk+svZf/gHl9VDqYYxsvhoTib/qbrT2VbMa82KCCm4/mWm7t6dFmxXRTGOUcRvV6sRFuFzXdTXabH2Jtz1+e+/rOpyBXdXy71dhjL0RSnqYHgSpgmiD6viqa+N+ubeuoOnAmBFh1eF3093BWnsi2Pxqox+glWVH8T9CFt9/hU/+Fe829lc0f31mc3kSu5P31cmO/VbdkeTVG3oznODYx705j2WCCKvk+Kqvo+bhrloTyPXF5zDNHpaTE8nL52DdrgZAiiz7Pi2HTDUPbMF8UDyX3Mqqn/3JvycCLrc9XUhftVStnBnLpMV3V5xxkfy94aIMxxeUaS7PosMVn75kqS09uNyfmviyQbvFqYvB3KjIMk7FCs5D+DZ2nbyPzAg+uKO27hoYCRxp2xfZ7SdtfJ1mARDZHAQKJuh7FsGleiZXsoBjNezpxFjgOMHv77Uld3bsxTHC81/YVYfAg4MFyoun7qk1TmTI9yF/kICowLtq+v/Vyx4gkYGATMX92tc4dUIoYG9PxtH75rbf+1N8d6+oBl2uTFL8dBhgDmdO76sinqofPqjp2p+8nN1J17c2971HwSdErAuMAfCzPGERLo6jflg+mL3gznrh3qr3VTjzVbb7IcoHd/MGfTHkxbPRR1aycypgHKNNrnHFki0J2vutb+w86enMujVH9oAtBbnx4nkJ0QCXTNz5evTV0V5dl+xm9MbzLDj8WAZgC98KAXU9xc2io71F68siSgM06/ppivzAb66mtfpTzXnFmIBLrpwcBBEE/RQE/cddkF6QAHdLPPph/qYbSVpbiMclOQowD97LU7hzxsEg90st1r1kzpMz3rkIBF+edeBRyqW3Oi13sWAwIuWrzYxmuAQ4oWDV5u5QoYpGjR4NU8AQOoR1BReh49A8ohUhR+Uwz1H9NEniwdYyXxZ+sbKYsnWFH8yTL2wPQJuGjxtKia2tbh2s6sWr1SenuzHNHs2Uzkpl8Xkxgrij+fCUud5sRjrCj+YiZMVZpTDoCi7MsZbeszp+rjRNFXS8lNNZmTDZGi8OsZfraLaGXDKUdQUfrNjF8rMCeegCX554+LwY5PKuO6uox4DBWln6x4eF1ssRKoovVT21Vrl86zk+JeXJog2jybGxPIIgGL8s+L+7KpDyWcC5Ig2ryws29f7QwzYJGARfmXbkUEUo+xoviraWnv0H3DCoiAixavkzE955CiRYM3wQw/m/4IKkm/oFbJ7Nh8qyaMG8AWE/BkqvR28vvAbeZYHAm4aPF0SaXXQec8KLxo8qw4t01RlU11acRyS8Ci/HN/XYmTDoCi7LZc5U2A5XYKLRZZkmj3srDLr65vu1UZzotmiEaviptyGH+66fpvZW9rygl4KlmSaPc6GLZyHiFSFJ7Hw/izIQmSzcvHRdWXw23Rm8p+QbnOZYIVxZ/YWfrmJ/sci1PX1mPX84WUYYhGT6cVtf6+bIrxtu9Gu3+E9SEJos2zZSiSWzJd5AOgKPt8QcMPO0cRrbzRsR2Il309sG8GTRBtXi7Jc4vfXLueYEXxV8ji8qKegEX5eZx87rubOrOgu4hHUFH6jcNDX9gULMm/erztOxn7srrj3wEKLlo82bYzTJ/7si2bh7GuuGLKk0S7p1ufzElg3w6WJ5o+87enFCcz9kL+SIJo83zqqNWDLQiw95DliGYvinlM6Sqr3Yk0DFAt4Zmi8cvi1pTjqTxjVYWAixav5H0Ki/wr3Q6FV6+XEQ3sQDNEozf+6Oxc2k7PyM/V5iiS1evHtl9lX0XIhoKLFk+Kqu+G4afq4rbOTiu3PTs9luWIZk/tuNBtRpbWnBKsKP6sMH3f9cVt2R6EPkWCFcWfB+sG0hwLBRctXtjNrrZZOhRjd+ZfvhQsyr8sqsswdidyZxNnxRJF21cL2y8QOzIx7YHNIUsUbV8v7OjDzFpmSaLdm+J0acb6p3lv1dwP49ei8iTJ7s3joqx/OnffTG8H2NQOOcYXYIsJ8CfiwYX+LEc0ezpt+C6qrmnmmb1l+zlnl2eJhs+mrfXY65GCRfnnfj/9AI6xGZZo+ML2AerWtqX3Q7Fse+3tu8xVUJYH7ObqMk1Yl2mt6H1fVVMOQ2ZP2Nvpwf5cDnRN6GzPy9KLDSgVlkO+W2eRv7j5RUg/YaFmvdHZrHjM4FPffadnC2LpCYmJfplmwTXpDhiYyd/XNlhjlLAks5/nmbJ33elUtgfMiyahVh/tBPmnvr4vR/DhM0yd6bTTZo+nT0Qtf50Hdzq/iIWafZ4GkDqrgIMa/b+xzsyApwYTVhTuTXlnN3RoW548Ebb8t2kUpLQLSLCVsjZkaLCdqj6QJNgKqhEBWJbu7kz/Nn90IFD2sJgw8NXcgJLku7K6NUgRbEBRcloBdw26JOpBMdlfuC0UsfAv4B4Kh/6Q3UAR635AdlA46Ofc9olY8zOwf8Ihv+Q3T8SiX6DdE++65nJSf7EzLNnMTtnozUgWYDaMZQu1+gFWEn5/OZ2xF9xDSqJLddV+SbI83BDtxxIM1ETT7SQ5qBHysAMsKqyttFmeZDi1L9paQJNAK/T5x3BIXvPkUwJkoX00NEmy+qspld1igoGYaLo/CR4xQN6RFScK1sdbM4yfpqULZfkwVJWtqsSyRJUlVIYJQbK4mpfMEfUAKwl/rO+NapicEhAL/fA4w8LNFMNimoRY6eo1wUBMNLU4wSMGSK1acaJgd8T6QBsQkDyaHiwAHysJLw8DS3CERsU/1I0BRmcxHJbvmgM0/EsJqAVSPwIsKvyPvh7RMTHJkY2+v+/Lb5ane1XzRIWl5sXN0RR22GMK4aK8OXX9A/iEfCwmvEyqaQwiDmZkmy+NiYeXDH7rxvqmrqYuI2ZBMDQmukJjmBrTv5rmjLbBWZ7GEH9iGZZk9sltrtGOqHI00E4zO0tRQBtda0eTQCtNK0dRQBukdfOhoiwfSclXxUMmeVDlE8gSFZaqJ5GhAXZ2+wbQ3/CQqOgyoX41TboheSBpWjuoalEc0Oid3ZZkdJkKOSojRXY8AmixjC51uYlZSjNFjlSj35nzsTvqsuMRcAtFJhY0KP6rKYdLr6xgEUlnpciLz4BNbBdMmx2fozJSZWYlgBZ+50SXI4q5w1SRu4QG2s2fXV32IpLOSpEpZZ/AUj6byrSjLjshR2WkyIxHQC3q4U6ZE4+hMNHkYoGD8l/m04e6fMQspZkiPwEFtTHDoG4SIpLOSpMhj4GaTKc3ldkJOCojTWY2Amphj/Eqs+JTNDaajKx42KDry6M6JwFJZ6XKzcYQTebTUpLyDEPlvtR/YCmO8aJBX1fmVzOCy5sxXJJ3XwFsciTAYsK6+SWSgxnhUzwJXja4sfvEkafrQ2VZO1RG0+xhMWFgVL0BMUmsBFYkJqqZtycYokk93Gmn5UgOYqSZkEvwiIFuIohgICaaqZ8EjxhotmskeMQAqqhox9ECtbs/SI5ktHT9dA85w0LNNA+b5KBGyDNRdX7njiXWcoRgUFr38aJJoBX++UoJosW0R1PbCGZYmJmmISQYmImmGSEYmIn2zc+wRDPbHwcrgAeFZJXVmKBANooqHMFl+al7j4r7YFBaW0QUCbTSFFNMkC3cMUD1u57j4Ybo/k6CgZoov4s0CzVTfRcpDmqkasUoDmoEfYB9LCqsbiJzPNHwoa2UlSBlICaqhx/jEQPoWSw4WdAGQcAkV6Qkel2fFLMOEVoS/8cUKki1V5SiYDb6/aJZnsZQsWc0R8PsdG8EycGMNG8FwcBMNM0hwcBMkHfFQ2Ki2mYww6LN/NPzS9TwzMn38nDwD1VnU7HIFBFBym15OISnZyCHkAJ4eOc0IAMPD6hv0wqQ+AYHtP2xBqTuExD9oBeAOQQUwMN/tSAHnyDpV7emunPbRfJv4Sruo0Xl7nSqp+OeU6u9RBoFTGgi6DddpGp+vuQjKcRGKwNzWLcKoQYrAdN/Z5dnGnV5RTTQq+kG88m02UiblJHHwVzmpfqP3YBUsZii9njXDXQAQ97H0lRe7pyP0smRdvjsyNVGxPzciuq0WwR+e3wO5nLdl7UN5vVl7OirtggXn6N30RRdzNO5XZd3+a5Gxsly9C578rTwRLfe2IZ3erLT/BBgFFMkj4M9KX20S5jt8I2ZflkdIgKi/4sNHocpT1BE82+56K6J5N+AsK4W99lUXQ808xsWUb0uv2ZCpyeiExTStH/FJM13sZZN25THaY1cFvXAmO5/XMp2rEegHQvxkvrRjLoefURA9I/H3hzL0Ryu+zJ3117iEZEQH9fxAZ9ARAD0lznZ6yXoOGSSsBAnvEvmowFluGe8YRHVqQsFl/sGR7SnSB1gih0WUrUhOUBRC8U0R6hF2bCA6nvoezUDET1zU14aVbGGFI0HXMgBA3DQzhIkFMBDNUsQ4gH1j/YKjrm7Ccn7BEDfO0H5vnZ75D61DdbNYum7vT+Z3u6OKpn4R3IKNhEkHXV7Gc3wpW4r4xffu6l3B/RRZA0kFbmrABIr4CqAoxl/M99V7biHB9R/7+2p667LB37ytVc0oDyPsRVVPmAgDvMGyGmuxcxPDnOimArHd92lHadT2DtMY7LCdz38vcM24ipcf7m5MVNB4d98mqrxtLe0KXM4c5QuD7/fm74pgcF8hqjxG8b6VI676mrEVbjOgV28FlbzaRBVfjQlyg8FqKVP1Q8Uyu6S+OHs/2iepzk23QCEl9ibhj29FkToX5CeH3xCebm9advTfFACe/3134GUvtfbDqyHsTzp2mtaQpGGq/beDKM5qOumT9zld8ncZyQbXuTLjTzeR3NvmKVsyspRFB5+/JoddTil7/Pe08b80HfvX/LB+xd86XwJ9Tsck/f57nt/KQGF/7yitKenF1L1nroavpA0Pjsqs74GbzVOazTTFF7/KGt7B8SeFiKkAp6fy2+awfUGR7QVO0MCOKC9rpQrxtcRB3FxJwTelyOWBQ+PqGuW6EI8pK7ZOxMREH3l3pmEgnhMl/Zg2hMU0NQ1wJrW9roby6ldmWb8sfm2iIO6zI2K1iigAV66vUsRQdK/LYffOuUsWcqBXNStBcUCnKbFO3hhJCJI+s10P5ebsvsE7fiJGVqH37nj6VmX34Hz6Y6zLBZ+6rtjb5DtRTQPdFuG6G/vy7rBFthzzL2OmhKl2Zjz+65dD9Wgfj5H76LJWczD3ewJHo2LxevUtflYOLiLayM1Ho6hddDmZGNhTuD+HA8M6n5HtuVtWEw1mAFB5QPSDh/NI0iImN/VoVF9DRa8Tl2TEZ+DuXijW9TEo6g9NJmJaJiXty1V/a2huPtdNVnN8VXurvruzXXE/hHnHTknFMAUAEFLY0s8eqkjsJcTReLI/UQbUlNSCx5TXzrQmvbJ5+hdNHmJeaAbOILw0Rplba8tZO1xUpVZwtQ4anpvG0ProM+Prg+n22efcvQu+hxtPI2b3kfhsJ5Wt3vaYZeAtcdJlaeECTo+tBXs8dBWuKoq9TMeU99OS6L6GwNz0I1zNGOc9QTzuTHI3CnF0jhpnoJ2FOXw2hmQkIU4abeQphzERbWJNCIg+i7SLybtsIiqZqEixCPquon4mAE5KKfiUw7iopsMjhmSQ3dv+r4+GN3xDIqFOmnfCJqHuqneDIKE+mjqcspBXXR1mmLBTsq6TfNQN10dp1iSU2/KA9qKbVhZ9dTdG1x3Q4vKl/aq/bWr7uBljZghOQym7KtbNO0+WlbGD34M8HmaAT9PM6DnaQYzuivSIE0HBTRV69eDav16UK5fD6r16+H2MmLTgQtSVBy789ImAKoeWlK+d/1ioAwWpKT4razHD13/2ZQHIK0+WlbuT/B+Dw8s6tpAsugr7IFpXT9ES21vDrkppw44FaMlCTQhDDBXvSLDlLKaofm3NOw391WghEyzV7ah7csKznRAEm3WABt4yUYUrYW2LBm6ZL1MZdlWqR7GuhrssaT8/N7mmmGKhsmqrjK3vABsDz/MiKE02Ju5HU9yo8JvQ8KBTX6557YCEg4TAZbfUR0zVMkyCjwDVwuSt8tMWUVEDTERXgQcPLsJSW+jzSgrINpPnVm09nhoUbivx7oqm2lFX5ulHFcytfsTFO+1D5ek7dXpp/Ksf+NoomjnL/MrskTyVGZok5WSVDY7CpKhS9ZXbuYHcJmRoOC7smm+ltVdvpucKK8U0OJT2Zcnhb7Dg+LCFEYijk1eLGBpHJXKg2Opq0y/+HP3DTWj2bJxGIGFHTL7jilNtor6q2jmUppo9XN9QHMyQ2VJ8bCkL4oei7yKen5gmaQs3AguGJ8AyHfcqleg2wErXlfvyurWzMNwvMlIWYCRRaOlsqFlYS/spCIHCUs2WioBe2OP7+ETRPl5X5viox1TRIv3l9NZmmj15D04JC3eORZpo9eNXf3CR+vyZH+B4nRdLYsskOSMhUVVH/eEBNvgdT1kwAb4R163ZnX1y3dTXaY+DV4XY45o8oENKuYpf0DiiDmU6smGDMwAf6YeHJPGn6ZiWfBqHqWA39MNLQp/7PILIJ7ix05c/LCYKaAIqDdhEVFuPSWUBJZTrpZI77Zh/P1sazpUDwgabHVd9kcDvX0hQzbA7nL2DVQ3OV/9asbb7qBoPgKCKN/edHvmH0ieaOaD8SeSslRGfGD9jA8UY/9qjWKF9vUCgij/qewH87Y/Kvp6EQW3+GyGSwM9joiCWNg94aC0haKSaKl7cFTaBcJWjJ8oHmq2TEXp7SKmbOjupkV79R4cll7GeJomMcdFTd3gZodjSETtrqzOPXAbdGoYU1HLj91xh5vHQo1+NeVw6feUZcTEDbUfUJKI2vmN/A5Tio5az+/sDteIiRq6W4V3+IVE2K4e7vaYeTTUapmW3GEXU2FL8EJ7wlF3q/1Kw26cJ/xU186vLOhSeMJNczP8VXg5+i471fXtV0s8lznszsfycMDGMiQRtrNXqb+9/qzouFFEld2H+rs5bMGc9lmTIqpk/Ltpmod95h5VtpwuJdPNtMYc0MS9T2jHLKSIFq6phccoHhyQtjedKQfZCQm0wYdzPl4W5w5r+qLAQc0JNG/bmmsdKh2yICPVBFpAwOTtpL4dhcHyCwGX11SbiAOZ4K3EhoaEP5v/clfG4qNaggZZ4XON+NkAB9W0OgEBkgdOrUX6+Km1CP5hh8UHrcmn8qHpynwEp6zTTJTtLpo5/A0tCkfBkdyuLPC557ha0312kJG+26ztL7vEvB87SHwBg7LLgF0l75FAG/QB4OU+nRDCNP8AIgTMsHdlU12acpx7hm+vP+MWKXefKTp7lSXvs426xrtTEOnsS8zUVd6dhImNG+P9mIgCWuyoS9oq9IOP8Eee3K4Hpn9OrmuhKsSVorLQvX4bR2Wy+0mRdJW18kl5JNlGO8eim1yZ0Hin2oMD0tO0y/r9gSsBwVObuW4Ndwcs47iS9bZ8TFDOEwoLmtB+P5t2n6Fjqg3ly3UZT/iK3YUJT3L4eEAc30ILb55d45eoPn4xCbb51H7UGHxqP8LS+Ag4ZMAG+ABYd5B8hV/X1Z1Lk5uF0VjF3B2mysYnS99jrWiAaO4OU7vTcp+lZe4w1LR6NHeHqbLly9J3WM+R5fcZz2TRNry+WbGxgCTCdu5m5R12AVG0mwMQaRrniAJauEJXGMwEUB5vOzWBMRaw+gtA8SQzG/FNf1CJYElGXvxQxb5xgqUwQg96xRSFhb7s8mTR1gxDeTSwkQeXpce+rmx6kJfFQ0vC89YH9En4cFA6CNOq3AYpSSiSAB+gTThqk/2Z1J+eDcjwa0uwQKMo9Oy+rDIiqmRon6nP2mH0I5nd/WTV529JHmimby1pomi3BRXW5CxlKYx25C1LFm3neIdL6A1NJjNU1HIJHqk2DImS3bQgjZv4cEQa/R6tWER0XX9WvshZLmKqr3YESzJax0touYUEVF55qJCioVb6YsswRUM+TLanD0XIdqj/8wQWLJ6Akk9xyaeY5Dp3onwfGDZobCdPNBUpZSmMdmYvoYKW04cenL+PKZiF3VunqGEWjtYye+5I/WB8Em6z66nERMzOTmOpc+WTcJudtS2lYpZrO77LlWSDxg9tparkCwGXn97Affmi2LixfRi7fWOyaDtPB8Ffbh+Piu/4mtJM0fChreCcLFhEdEcOUpZkZOeB0dSvWFE0mfFF1BOS3kZZhXkB1H6baFZYbiS9zc5c0gKS/byt0YAbg304KF137Z7zwgxbMg5vG1B8Jmkiaqe20cjrWwuSh5p1Z3V+fBJt48eWHR/OXFjZrv2Ni1Bh2cWGk3LFVm6nBdRnLHrRJKeKW+SCEW0hpqSNybMDScK81uQprGIO5uRNyyq8UpbKzU0U6v0CHubojawUfilL42b7Y2ozj4R5+R9PhRtB0/nZz9gOP48m+l2qOzPK7cuGkxSniF8f6sZ8mONs88IJHNb/d/Mgt2UxWlYXj8TNuugxuOWQvNvTjqguWFF5CpYq3AHgdD0kpioVK3ZFwQxjZjN8NXkWY9HLT5YFeuJE2aL3DNN7huo9x/Seo3ovML0XqN5LTO8lqvcK03uF6r3G9F6jem8wvTeontQ4zHpy2zDrfcX0vsp6dsgDfTECqKT7vh7O5Vjd8pILClWTmoUFJ7cL7/vu/KHumdsqneACg/XEJC5AOY0u4OCV8FgWlKx2OUlKl5OoMofjk7//PlJSncLCYR+8AArpykldYaIe1EFB+yULTqoyC06uMaui8LlbFcXv3b8ZF3CCOVM6KW44UbHpvtolDrkP4iPFPXjL8vjH7lhXn3oXTNn09zVz8GNy4Ziiq7z30nngWy3tTj19HjIs0W05Nyn2Xn0kqop36SmGxgXq2BME0cNFlxAitTt1HyrvUqZOCQoGJAd0UhiodIUNtb4ufAohPPUiaUdweH/48tYLu3UXF4q0Yy866LMRwL3H+hYjyxM3IHdHubmYQfK+XBf7U/5E+0h5b+wUGE1OpQeUNW3wM0RywYGbgz93zPGPWXIFgprXXdfYnfeQ7gKWtP0lBLkcYrRGnZ+iT+ShmfnfpM7vb3LfF4mCOWkp4l8uc7XmXsqyj1TscnRbv6/degEnT1FEn7ZxI01Be4GJ++OmaEtyAW84WdEGP5Lblw0nKw5j15svbXkebjuhRY/AyP5AIPczClH7tTzLYr+WZ0QLKMUZpdp8KUuuUHSzoFyGPlJUnS5u/WJGexJM6ESFWFlZvuV0loWvN/0Cjti+wCO2bdeYoLji0E1fyIA/xGLK/ucBmtvK0sBNQrYgry9n6VMeoxV7n6T1ZF/fw8sOtm8uv9kbTt5iVI7IC7jAZL2ph48orkBQU5paW2Hotio3+pM/tikedZgjTplykBpOigG72LVVlclGgD2AjkOIxZXtZAv4xpAc1Al4bzwksq0NrkEBVtwlhcxgXGNzFzNMmrScYfKc5Qx8N3b5MLG+ogWCmsjsxLXmFrnr3bOMHFPp6gKe7jD1ibKneFnabIHek3btdhwAz3kDipr+VU+AcgwX9cXLnJwueo/TNXj/UagK1s34GiOsimRYoht/B5LThq4/ukauEPL0wNLYNY+eYyncFG8nTZK9uiNQ1WeUqLZMrLF7952kD1XpAsmN4bI+do3BrK66uiCCI6lPCKJHcvkNYENyRCfpPhinDV4Fc43caDIr4peZ+FigHCI0rB5fd6Kwoqiob3jpCW6a8lDH+NYT3JNioq7e7Se4YURCvaLLT3A/goh7KpuFLA91pG4/wX1zbNQ9ugUFNyaIqGd4EwpumfJgR+86FIVfxELd4ttQcEeKCbuGEZ4VpikR9gxuRVFYJjzY0Q/eqTCMabhfcDWKxjEhip7eRRSAUYQG1O3yB/BR34AKTSjBPljW5q6pmBWBGyomkDiTYUHAPAZwO8GmB45i5vfv7aE8j8w1Ok43BKPaiuq7pzUQ4qLPwlBI9BkmPi8HA54YvoflWrOH5XpqUcBn5kExXc3zUrdsfiRYyCCEA/pC8NhFF4sbuwLlOjEDkVqBBVoNdcGasXO3Tp6nclTMTeRooB9UdpoYiw7rdibwsj4SU5Vn8TccrfjP4HCm+V6e3FIgdT7z8ZPi6JaHi2Es+5EOiTprFClaytPjp8XNtL/86zz5y8rHYFH9WXFpD6a3bcphStXUXSNXxVeTDEf0el409b0pxr48ZL4hq0UIFZVfFL39qJ/KtjyaU+aA/yqeoEX9l0VZF915rE/1H9kj26t+ghb1XxVNc4IKJkDmau+mfC6ru/Johkzlvem7dvxzb8oD/cos9GICFg4o5ebYl+dbRHQCgqKnrj12iOgEBEW7pilPJaLqkKDsuW7NOCCyDgnKDvXB3NXVHSK8YGHp6Q3GlCcoKxzUQPd9y1TAqimHwZDNzUwsZoiUhZt5nzmrtYIktfU4Pyu3oeRysB8eT+zU2cH/8Ofpv0P2Uy4QQDimm8tmVtkQoeCTp37WpkjutsexBAeKw3lsufJ0CUaU6hcvZRM66gVqmI96QZhngtnRXkwIu1C6PBzotei1Zs2yETDUfPk8lMwtIxKi3CJiLEuuxBGa2XW4WJAaEhN6uQFxLEeP1wjB/Ggtkcx09ilRpqsfy9K9YEI03wcOJZv62F536Y65RDIEMpJb8Av5fY6g7LsUYdE3mKFxdj8nndz7sq9tEOFF+WeyZ/vsKSGSjRKTJDfDYFOabqhIkkrvpQjTumCEkMtpklkilHKxokRIhag2E8pastHE9j3BQsLh9sRJKdZLNyY+ffzm1ZMX5NONoo7lU0mEHMskUVG7MxTexm7a4eq2/Z2t2EIcn7BQgfg9VPFOsXiYLtGG4LpEUhygNKl8/J9cSrn4P6mHFPdHcMnE/cn6MPF+ck5cvJ/UR4rzw7uQcX5yJtn4PjkPNr5P6iLG9ZF8yLg+eZ9sPJ/UZ4p3k39vp5+Z19ZtL8bHBiSea1hIAvi5ELmCcRLYxy/xXEAfqojpgD6pGt1vSxUre/W3owz5zqCPYnqC7g0z09yc/PwSMFuGCRp9ciyRtSRjHAVFnY1tRDy6CSt9MD0Ul7RqykgyWGUeIE1gnuXMWD+MovaKFEWJDiytmenGEpLR+ykJR3BZ3qtEoraHFYW9L62k60E1su86f0wjSls4Ku++26C4A+ukFWnfCFz7RMcoCl/pbGwiovGcwN6RL/Et8bFiWfjfeknYx6qEkTKO8bCB7T2g4harEtakfMGzlWNa32YmABYE04mpemPb1+10HpPAGMqlra/HuiobJoBv+inJcbgPy/uuJQL1Jto+jJW7nM758rS/MmV5uJzOb4+mHd+2wzd/RBiXZARkytEip/LgxSaIIPO34EgbpfK35Azby+d/cqNEq2HOvalKu2obKX82Vdczn7ANIyTx2hY2rzNBJBn7V17FfOfeLHOqx9H02TWI5fdQ4jm9GFGus+ZfLl/tae58/Vp1Ew5T65b166VzYAd0uBPD5jzXaRLcKKJw71HXmnWaETYgWILHdDWkSt9jCNrz7LZKPeAw+sa+7b84JiDtwznV7/WoEN3QjOZtfbw1w+j6OnhhUDTGpT40yvcrYjDaJ+8KTFg+JTEO560vizukJNlB+xQoGueyhVHBq1FK4hyi++AUNjQT8HLvpN4p4DE+dnsN/kg8NKM5eJeN4doEi/O4vYzTJbRwyUQMTnvqYuqfMskTfbT6qK79Vmi1PY6o78ZkiuebsjiPIDqAwoXicT72ahpcfUMzmvfrDSC4csJh9L8Ft33gHiRP9MHr0Dewzfm2XruhTbvHSfT9HTxp/F5/yoKO25vOVqRH0OPk0afPn4UiwtnwVBM4Fh5YTF+w8VMfyMbDDg/EjDwc6j8u5VREktqCYwQz8YX9x8HEFU6fydEwQ6uj4UZVRzNiG4IioCB5PPbmaIel13154NYECLAg7WaIhQcbAXnJ5eN0XZ/MTRhHgNBN0IK4PE3to3gxcYllwwhC0/SyWIYbTJCLr1ygtKgbF1KhcJ2E1EkXSgiZkZ1v2DC80Ht28m0GCBLmprw0UBGFUFBWLLAAyYv+cnNj3CyHfeZ22oFVTuGCPLhPMIHystA+wRDHC34sp/mK6OZdQtEH8pK/bqPP97U7ATWFoeQmn1naHrtPprfnMMsjX6clsmBdt5fRDF/qtjJ++bybZqqZGUmZKxh3ByFf3UFI+2/mO9TGejhe8Pf+YPqfu+6OlVtRvNi8HAjUywApiHZDbdluH/H8AHhxioGZvOsu7TTe1PjEJMxqqcEap4iDGYWNIOQTUkCbduxrMB8zFhd++P3e9E3JrA9mCKDFMNanclTVroiDGf3VzVF6DRjSyIrsHzAHm1xQQ5WQHVnfk9/dmfyBnE2zn1jPmqfusNV8vhGBH0vCzqLPy+xIjua1pog7LPG2NqXtsLNjvWEsT1gDSVMx26v23gyj3RsIVi2foLW4tFqPS7xvIWcyxYXHqoSDYrJew6ipdSlNbad53fd+QX7o0/Fj3wyfDb9bMUltpXuvKCJmOW/v0vRyQorKBquTCxiUVlQ/VZ3b6gqqPcMx+X+UtY0WoHlZQwpv87n8hozXNpggBxwQDGC83Lo1FBiyRVhBmArUT4nm4vQngshesxCn3ZQ0sZEDkxFQSDh4YDKBCrIPp6+d8MAmCC+DtW9gY3bdjfPxE34SxcMhgt0wwqIrFhCemwlUO4Dz8thp1gjISNJXAPqrMfmr/9LFmNty+K0Dp2pSLJPMCQw3KRSaF59WX8SZ8wjISP7VlMwipv2VWb6zP5/KM35IkCZw20qDbjqTUB/GpdjHAbtfSTycXulAZgqGpRVlztA4uyt6yTHRv8qvOBKCRMSF4MI+Wp5m8WbhgmX4FSZcUjgr/3N9kCRnCC8Tnk0WiiJFC+Lh8VpKMD1gG4lQJ9pSoey5tkgszaXfgueuPE3b76t5GyLwCsdQNoF2n3rSuqaSHkyUS8ON03p0pPFIMLc4l0pya3ORKLk0lypmV+YiubmRF+ryhmLFPnZHTuVjF3/qE/o0Ey5oTBhJ6Mi/Sw7BiiwB6+3j/v08hoGEUkUCzstnwtsTykxs+0i0vek0R1FIPGuQBKjn1BMwn/Z4807cbaD37gQ9Bvq646DVyl5znLZb9Yz9Mprzr8xwOMQx/bfam1m87sRJAhLOyF+tq57SFyAAsk8lOIIIfPUoPGKwdNpwi4jBm1B3GhDKuQsNMnLxnQGIdsxBjMJ7AgCXkIBYxNcCACYxBbHxLgMAHDw0Ih5F/gcMIgZmgrbbJAGxoML6A0YUDbGLgvkDThEDMQnD9wMeIQGy8CL2IwYeHJGPw/MDFjEFsglDcCMuIQMyCULwIx4BAbLwQ1MjDj4eMwhi7EMWAYM3mafOv9R/mLfXnz+VfXliOzskAbb4UH83h22FSWdHkmHrfzdN86Az9Ci8zRRYOr6aMOiO+RBxHOnA2CA3xgIJdZVc6n2EUFbWu6SBk/Rggpy9QgEcjyRgXroe7ua4l/NzZrUTtCj+zkaqedsf+TT7QFFSHgTnVpUoMeTZB0BR8u/rWRtJc0MqRD8oZOMroFnhJA6HpE5H5Qgtonnz+c5avrhzHI2RzkIUxz/Omq/yfK/22LGCCwiQWke5iKQHBqSlAsXKcVqNfFc21aUpx+RzF3whSKz4qSBZb68/82mnOfqsRF9ktWnE1ydg+kKrbScWYAY8L9VjUjwdzUPZ+Sz2PgJVyesKPP7UEQVOfudyBe7AUIGvUDiZ6gInabAdWOAemJdGxy34gGUedxDtZ/gcI5j8LL3LefiUbjghoW4/x6f2I6+3wiC5z2a4NOwSTYiEROXeH7c7JSN6XVd3cWqjZxQDgacUU1zXGUl6zFFmwvWYgrh7iNdK09pFG1MgL2J3imhkVwl1NpahNLGH77S5cRylEREdEfHKREkU7ebNgDqzmcRahdHogIl8kgBZuLBxCouAwFq4HU4u12yrGgABSbnBym+uogXh5pXCcwZN/TW/DNfUX5kVuKYeRtNuV2jkV7diJLOwFUN/b7nt1BRaFF/OoH+aA9tI8jFeNkii84sWCWOHCVJUNEs0e+9FIpMsfKxKGEl/jIcMPgaf4Lzwx+SzywiiqV2wkLB7exFZh1SIound0KK4EMbRA8lS37kothtGFMrsS6QVmd2JkjRSnAlBtFj2REnKCw4WRJLrY0Vh7ziJpOtBNbJIkiO4KO9tWYDbZoqzywjJUI6HGrq6ps1bxNpppsgfwZRNt8B6ossGFWXD26dpvfT66YwQUgQLThT84oWvk0R9rEoYSXGMlw2E7fU+ChRDex8hWikOFUbCAE2QXsiGVIjiqYb7Ilg89RSrEsbTveFBA1waEw1CAIrCAVopDqU8YcgmD20lyj60FSQEpXHGiYLU0iktmVs6JUSxfjTYh/5HEOQQE13QoDhSooqOuYOi49sQLYijUahSrCAMxaGKgIKk247HqzmMIIScbA1xgiB2ljNGSqLgac4UKwhjRwZjJCMafgrjWaf08xdMO00Ry+FTVgSamw4LjjUkCYsPNYTp6o75vejzj9IKwnKyIJ+GBcEkZIF8qBvDXY8X40LJ8JK8Fds1B/7SvRSJ6P4WBI70S85HoMX3j75m48uGOLYoiVFuqpYZ3+akgMNRBJqrth5cOtsYQ0FZ/I3Lk1grtz07/wZ5ALEaRO1+8sCINv9ZKiBfRxviYMG3h/Ic1M/oDaLA7Es0EbiiW37HSo5vnjeMmGELgjLrAfmMDkN5NGIN9GB8nZtwn7sm1/ZsALnkJuh11zXvyqZh9RaQrDnedgc0yjOFZp/Q2NeVfUO5pS8PxZUkfQgtTmH+6FmQMh8mv4MUGhTPvzExSnpSPp5/e2IkmNSoyufSSlX5JLHdven7+mCw0NUUmunaLXB0nEDjAQNovECAAWmku59iAWGs20+hEXGw+0/jAQNsGEChGfFz2Q8m3CweK64QRmaeV86/dzOAed1mRL5R8ADSKzZDpb6YD+OaV2pVADz3K1FBW/Eq2QSrEtZnRnePbEAUO98EGhCP1jR0WWLIsDX6jHy0UnxPpnY9KTgQDIkHDPDxDE3gLM5uZ+v7+uaGadU2ENc8OtR1N22e44PYpVhZ+O9lc2FmHn0U1/pSS3NhPz+7JBf28D0Y8vBTNPvoN7jr114/nDM9fxIqtvobSVG9siQhK+kp96TE6RPuSYkHh9WT8VryJaUJ3JdVPENPp5w/P09mwx0CRPMQoOUM5M7mk6nnzuWTSV/O5qCJj/By8vPn/skM8Gf+ySx87I5o6jeonHAykgCZ5mwUATK585QSmuQQLic7G6OATDobnyCTfDt1gqfeQyOJp2MfZNKej3tAJt3vDaAZIDhyNvj4CmRm5NgKZJbmbgKamxAuZyQbuYHMAxu1gUy+O5iMpj5Ay4nPRYQg085Fg6CTbo8oownfsECyySgTdKKzESbIJC87atBkR3g56fkIFmTy+egVdBbcoVc4BwEcyEDu+C2dfu4ELp38afcHnHofDSQ+E3ODTjsTb4NOuj2NBqfcAwMJp0/E0enOH4rLJHs6moYn3IcjSc/ECMkknokPEiU/iZIQKZJxEWgNG1GDybmH4jIcXf2LDJQyFHaIEdz7qzAJCZxFb8qDtEljwzADUPfNyJes+50pUweQVxtCnCiYn0zcfpdGlQ7JrypsGDZJNw17NeoMYCR6c+rujfzINhT70GzYEi459nc2QxbAjYE3BPd2OlR+C8L2u/ysLFLafuCjuOwFO5MTkWRPckIG3lkfxr2pFsdU5vlXsXjq4U6aE18xUnI+G3tpb9214KRkliMZ4XM5BJpt/rpLe7AHL5nFjw3DvEn9pb1qf+2qOzEAeYxkRJc+Yb4KLgimGi6QfN3xEVL9Wc/BSpUoBHLPwN/bDrwvFByRx+tQhsGZDKbsq1upVfZR3GN3XWnmqTsA99AdQv6aRkBZkqlGucs6iFrkoPwX1QMxyRq4u6MH9u7oAbj4d0Au/h3ki38H4OLfwYxxLGVChgqmHMtA96sM6P0qA3i/yvBD96sMt5eRP8u2ILhXx4td1ZgD+F1iWGzL4mhuqUdut1I0KK7MRkKRbZiXev1dfKfnQfRNBxeGD5YTadGqkogJiAV3p32IwcrDxqiAy8MHy4l14S9UJZJSZJv1Q65yIlmA2UNbTRVYZ0axQLPk2aRP3MdhT306enM2aL84T2L7HMudQ19u6xsbspy/946Ec61+MyHWUOgTjZVP4VxLHX5Lko9/+gkJeyP2d6B748NQOWG/LIXlxrYTnmlhl5/FqmWBQpdpgUhZBbYFxzgui8PYnZfNbEwV8VBszZgmBrlcTgA2jxMCqR8BUJbknuMKkJ/kBJWe5QpikxWXeqpDlTgp4jaY5rdkpDg5p/M5SRdN1JRDLjYxhYTVbdsPiW9AWHvaOyV8Jkgs6iCOpH0c+1VbtpPiI12awZoEx1iTypYcYA0r2kNbidldMFIqFNlM0bz4MJoTl0n7O5PNa3d51LvRj83iVxgPINWSa/8CJEYxhom6dSVOBK4YrrSuP3ZHJl3zr2JylgNh4VxyIOVDZL1gQwSTwBQoaidX7TDyJFZyGDu3m9Lufw2iCsef1AjIfFWvyf1qQVLzF7KkReBhmcxHKFg13nYGWFAU1C/cKCabpXjUKd7RJXtRDNTN24slG0Vg1CPaNCX7EATcC3yns3jUidqBJPvlWKhrtGdINiQIqFe4x0e2SvGwk7cxB/CJ0KhLvH9GdqIYsFu42wUwSwmwV7A7BbBK8LCTv58EMIrhuE+w9QNxSgjiJ/Ssmh0h4czndDyrZkdIOPe1ToK1ct20BMz21xI0OEvFExHLLS4sYLOBddLK3NBE1tK7QYapuhFKfDeorRSRIL2TgtDCm6c97RLaTOjbBz92OiscwiTdexe2iHn9FwTzSi4QW1k6Mb4ahdauiC0a4GXsJHyvJ3xPe4aw2xe1kyLXbaGqNHe0MiyuSfhW1uOHrnfjgnziAxiT9hn32ZQHZjrVRzFicSCueDaDCsEVzGaE4bSAxSyawJUfvMER39jokO7kGN2M+AipBZmPUhOLpZkkZtdNiUTiE1kknq+Y/clVN2aPgwfiKqXdLCftcPFAidQ///ef/x9ZmpLd"
|
assets/search.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
classes/types.ActionBase.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
classes/types.BrokerBase.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
classes/types.MarkdownFileBase.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
<p>File format: ./dump/markdown/{markdownName}.jsonl
|
| 12 |
Each line contains: markdownName, data, symbol, strategyName, exchangeName, frameName, signalId, timestamp</p>
|
| 13 |
<p>Use this adapter for centralized logging and post-processing with JSONL tools.</p>
|
| 14 |
-
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../types/types.TMarkdownBase.html" class="tsd-signature-type tsd-kind-type-alias">TMarkdownBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 15 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MarkdownFileBase.html#_basedir" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_base<wbr/>Dir</span></a>
|
| 16 |
<a href="types.MarkdownFileBase.html#_filepath" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_file<wbr/>Path</span></a>
|
| 17 |
<a href="types.MarkdownFileBase.html#_stream" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_stream</span></a>
|
|
@@ -22,16 +22,16 @@ Each line contains: markdownName, data, symbol, strategyName, exchangeName, fram
|
|
| 22 |
<a href="types.MarkdownFileBase.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormarkdownfilebase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MarkdownFileBase</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">markdownName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.MarkdownFileBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFileBase</a><a href="#constructormarkdownfilebase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new JSONL markdown adapter instance.</p>
|
| 24 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">markdownName</span>: <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span></span><div class="tsd-comment tsd-typography"><p>Type of markdown report (backtest, live, walker, etc.)</p>
|
| 25 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.MarkdownFileBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFileBase</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 26 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 27 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 28 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 29 |
Protected by singleshot to ensure one-time execution.
|
| 30 |
Sets up error handler that emits to exitEmitter.</p>
|
| 31 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 32 |
Waits for drain event if write buffer is full.
|
| 33 |
Times out after 15 seconds and returns TIMEOUT_SYMBOL.</p>
|
| 34 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 35 |
Appends a single line with JSON object containing:</p>
|
| 36 |
<ul>
|
| 37 |
<li>markdownName: Type of report</li>
|
|
@@ -42,10 +42,10 @@ Appends a single line with JSON object containing:</p>
|
|
| 42 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Markdown content to write</p>
|
| 43 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.IMarkdownDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IMarkdownDumpOptions</a></span><div class="tsd-comment tsd-typography"><p>Path and metadata options</p>
|
| 44 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if stream not initialized or write timeout exceeded</p>
|
| 45 |
-
</div></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.dump</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 46 |
Safe to call multiple times - singleshot ensures one-time execution.</p>
|
| 47 |
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 48 |
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.waitForInit</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 49 |
|
| 50 |
<!-- Yandex.Metrika counter -->
|
| 51 |
<script type="text/javascript">
|
|
|
|
| 11 |
<p>File format: ./dump/markdown/{markdownName}.jsonl
|
| 12 |
Each line contains: markdownName, data, symbol, strategyName, exchangeName, frameName, signalId, timestamp</p>
|
| 13 |
<p>Use this adapter for centralized logging and post-processing with JSONL tools.</p>
|
| 14 |
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../types/types.TMarkdownBase.html" class="tsd-signature-type tsd-kind-type-alias">TMarkdownBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16031">types.d.ts:16031</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.MarkdownFileBase.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 15 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MarkdownFileBase.html#_basedir" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_base<wbr/>Dir</span></a>
|
| 16 |
<a href="types.MarkdownFileBase.html#_filepath" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_file<wbr/>Path</span></a>
|
| 17 |
<a href="types.MarkdownFileBase.html#_stream" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_stream</span></a>
|
|
|
|
| 22 |
<a href="types.MarkdownFileBase.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormarkdownfilebase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MarkdownFileBase</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">markdownName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.MarkdownFileBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFileBase</a><a href="#constructormarkdownfilebase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new JSONL markdown adapter instance.</p>
|
| 24 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">markdownName</span>: <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span></span><div class="tsd-comment tsd-typography"><p>Type of markdown report (backtest, live, walker, etc.)</p>
|
| 25 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.MarkdownFileBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFileBase</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16044">types.d.ts:16044</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="_basedir" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_base<wbr/>Dir</span><a href="#_basedir" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">_baseDir</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>Base directory for all JSONL markdown files</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16038">types.d.ts:16038</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="_filepath" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_file<wbr/>Path</span><a href="#_filepath" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">_filePath</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>Absolute path to the JSONL file for this markdown type</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16034">types.d.ts:16034</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="_stream" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_stream</span><a href="#_stream" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">_stream</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">WriteStream</span></div><div class="tsd-comment tsd-typography"><p>WriteStream instance for append-only writes, null until initialized</p>
|
| 28 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16036">types.d.ts:16036</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="wait_for_init_symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>[WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span><a href="#wait_for_init_symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">"[WAIT_FOR_INIT_SYMBOL]"</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">&</span> <span class="tsd-signature-type">ISingleshotClearable</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Singleshot initialization function that creates directory and stream.
|
| 29 |
Protected by singleshot to ensure one-time execution.
|
| 30 |
Sets up error handler that emits to exitEmitter.</p>
|
| 31 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16050">types.d.ts:16050</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="write_safe_symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>[WRITE_<wbr/>SAFE_<wbr/>SYMBOL]</span><a href="#write_safe_symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">"[WRITE_SAFE_SYMBOL]"</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">line</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">symbol</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Timeout-protected write function with backpressure handling.
|
| 32 |
Waits for drain event if write buffer is full.
|
| 33 |
Times out after 15 seconds and returns TIMEOUT_SYMBOL.</p>
|
| 34 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16056">types.d.ts:16056</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="markdownname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>markdown<wbr/>Name</span><a href="#markdownname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">markdownName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16032">types.d.ts:16032</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="dump" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dump</span><a href="#dump" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="dump-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dump</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.IMarkdownDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IMarkdownDumpOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#dump-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes markdown content to JSONL file with metadata.
|
| 35 |
Appends a single line with JSON object containing:</p>
|
| 36 |
<ul>
|
| 37 |
<li>markdownName: Type of report</li>
|
|
|
|
| 42 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Markdown content to write</p>
|
| 43 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.IMarkdownDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IMarkdownDumpOptions</a></span><div class="tsd-comment tsd-typography"><p>Path and metadata options</p>
|
| 44 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if stream not initialized or write timeout exceeded</p>
|
| 45 |
+
</div></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.dump</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16076">types.d.ts:16076</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the JSONL file and write stream.
|
| 46 |
Safe to call multiple times - singleshot ensures one-time execution.</p>
|
| 47 |
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 48 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.waitForInit</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16063">types.d.ts:16063</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#_basedir" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_base<wbr/>Dir</span></a><a href="#_filepath" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_file<wbr/>Path</span></a><a href="#_stream" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_stream</span></a><a href="#wait_for_init_symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span></a><a href="#write_safe_symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[WRITE_<wbr/>SAFE_<wbr/>SYMBOL]</span></a><a href="#markdownname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>markdown<wbr/>Name</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#dump" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dump</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 49 |
|
| 50 |
<!-- Yandex.Metrika counter -->
|
| 51 |
<script type="text/javascript">
|
classes/types.MarkdownFolderBase.html
CHANGED
|
@@ -10,22 +10,22 @@
|
|
| 10 |
<p>File format: {options.path}/{options.file}
|
| 11 |
Example: ./dump/backtest/BTCUSDT_my-strategy_binance_2024-Q1_backtest-1736601234567.md</p>
|
| 12 |
<p>Use this adapter (default) for organized report directories and manual review.</p>
|
| 13 |
-
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../types/types.TMarkdownBase.html" class="tsd-signature-type tsd-kind-type-alias">TMarkdownBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 14 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MarkdownFolderBase.html#markdownname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>markdown<wbr/>Name</span></a>
|
| 15 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.MarkdownFolderBase.html#dump" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dump</span></a>
|
| 16 |
<a href="types.MarkdownFolderBase.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormarkdownfolderbase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MarkdownFolderBase</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">markdownName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.MarkdownFolderBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFolderBase</a><a href="#constructormarkdownfolderbase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new folder-based markdown adapter instance.</p>
|
| 18 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">markdownName</span>: <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span></span><div class="tsd-comment tsd-typography"><p>Type of markdown report (backtest, live, walker, etc.)</p>
|
| 19 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.MarkdownFolderBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFolderBase</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 20 |
Creates directory structure automatically.
|
| 21 |
File path is determined by options.path and options.file.</p>
|
| 22 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">content</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Markdown content to write</p>
|
| 23 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.IMarkdownDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IMarkdownDumpOptions</a></span><div class="tsd-comment tsd-typography"><p>Path and file options for the dump</p>
|
| 24 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if directory creation or file write fails</p>
|
| 25 |
-
</div></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.dump</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 26 |
This adapter doesn't need initialization since it uses direct writeFile.</p>
|
| 27 |
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves immediately</p>
|
| 28 |
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.waitForInit</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 29 |
|
| 30 |
<!-- Yandex.Metrika counter -->
|
| 31 |
<script type="text/javascript">
|
|
|
|
| 10 |
<p>File format: {options.path}/{options.file}
|
| 11 |
Example: ./dump/backtest/BTCUSDT_my-strategy_binance_2024-Q1_backtest-1736601234567.md</p>
|
| 12 |
<p>Use this adapter (default) for organized report directories and manual review.</p>
|
| 13 |
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../types/types.TMarkdownBase.html" class="tsd-signature-type tsd-kind-type-alias">TMarkdownBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16093">types.d.ts:16093</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.MarkdownFolderBase.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 14 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MarkdownFolderBase.html#markdownname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>markdown<wbr/>Name</span></a>
|
| 15 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.MarkdownFolderBase.html#dump" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dump</span></a>
|
| 16 |
<a href="types.MarkdownFolderBase.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormarkdownfolderbase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MarkdownFolderBase</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">markdownName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.MarkdownFolderBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFolderBase</a><a href="#constructormarkdownfolderbase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new folder-based markdown adapter instance.</p>
|
| 18 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">markdownName</span>: <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span></span><div class="tsd-comment tsd-typography"><p>Type of markdown report (backtest, live, walker, etc.)</p>
|
| 19 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.MarkdownFolderBase.html" class="tsd-signature-type tsd-kind-class">MarkdownFolderBase</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16100">types.d.ts:16100</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="markdownname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>markdown<wbr/>Name</span><a href="#markdownname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">markdownName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IMarkdownTarget</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16094">types.d.ts:16094</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="dump" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dump</span><a href="#dump" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="dump-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dump</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">content</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.IMarkdownDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IMarkdownDumpOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#dump-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes markdown content to a separate file.
|
| 20 |
Creates directory structure automatically.
|
| 21 |
File path is determined by options.path and options.file.</p>
|
| 22 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">content</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Markdown content to write</p>
|
| 23 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.IMarkdownDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IMarkdownDumpOptions</a></span><div class="tsd-comment tsd-typography"><p>Path and file options for the dump</p>
|
| 24 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if directory creation or file write fails</p>
|
| 25 |
+
</div></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.dump</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16117">types.d.ts:16117</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>No-op initialization for folder adapter.
|
| 26 |
This adapter doesn't need initialization since it uses direct writeFile.</p>
|
| 27 |
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves immediately</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMarkdownBase.waitForInit</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16107">types.d.ts:16107</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#markdownname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>markdown<wbr/>Name</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#dump" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dump</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 29 |
|
| 30 |
<!-- Yandex.Metrika counter -->
|
| 31 |
<script type="text/javascript">
|
classes/types.MemoryBacktestAdapter.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
<li>Memoized instances per (signalId, bucketName) pair; cleared via disposeSignal() from MemoryAdapter</li>
|
| 9 |
</ul>
|
| 10 |
<p>Use this adapter for backtest memory storage.</p>
|
| 11 |
-
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TMemoryInstance</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 12 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MemoryBacktestAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 13 |
<a href="types.MemoryBacktestAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 14 |
<a href="types.MemoryBacktestAdapter.html#listmemory" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>list<wbr/>Memory</span></a>
|
|
@@ -23,34 +23,37 @@
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormemorybacktestadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MemoryBacktestAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.MemoryBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryBacktestAdapter</a><a href="#constructormemorybacktestadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.MemoryBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryBacktestAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 24 |
Call this when process.cwd() changes between strategy iterations
|
| 25 |
so new instances are created with the updated base path.</p>
|
| 26 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 27 |
Called by MemoryAdapter when a signal is cancelled or closed.</p>
|
| 28 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 29 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 30 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 31 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 32 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Array of all stored entries</p>
|
| 33 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.listMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 34 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span>
|
| 35 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Unique entry identifier</p>
|
| 36 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 37 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></h4><p>Entry value</p>
|
| 38 |
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if entry not found</p>
|
| 39 |
-
</div></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.readMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 40 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.removeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 41 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 42 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Search query string</p>
|
| 43 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SearchSettings</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 44 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Matching entries sorted by relevance score</p>
|
| 45 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.searchMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 46 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 47 |
All data lives in process memory only.</p>
|
| 48 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 49 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom memory instance</p>
|
| 50 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 51 |
Data is persisted to ./dump/memory/<signalId>/<bucketName>/.</p>
|
| 52 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 53 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.writeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 54 |
|
| 55 |
<!-- Yandex.Metrika counter -->
|
| 56 |
<script type="text/javascript">
|
|
|
|
| 8 |
<li>Memoized instances per (signalId, bucketName) pair; cleared via disposeSignal() from MemoryAdapter</li>
|
| 9 |
</ul>
|
| 10 |
<p>Use this adapter for backtest memory storage.</p>
|
| 11 |
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TMemoryInstance</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24676">types.d.ts:24676</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.MemoryBacktestAdapter.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MemoryBacktestAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 13 |
<a href="types.MemoryBacktestAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 14 |
<a href="types.MemoryBacktestAdapter.html#listmemory" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>list<wbr/>Memory</span></a>
|
|
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormemorybacktestadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MemoryBacktestAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.MemoryBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryBacktestAdapter</a><a href="#constructormemorybacktestadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.MemoryBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryBacktestAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 24 |
Call this when process.cwd() changes between strategy iterations
|
| 25 |
so new instances are created with the updated base path.</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24788">types.d.ts:24788</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="disposesignal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose<wbr/>Signal</span><a href="#disposesignal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">disposeSignal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Disposes all memoized instances for the given signalId.
|
| 27 |
Called by MemoryAdapter when a signal is cancelled or closed.</p>
|
| 28 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 29 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24684">types.d.ts:24684</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="listmemory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>list<wbr/>Memory</span><a href="#listmemory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">listMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>List all entries in memory.</p>
|
| 30 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 31 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 32 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the list is happening (look-ahead guard)</p>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Array of all stored entries</p>
|
| 34 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.listMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24728">types.d.ts:24728</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="readmemory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Memory</span><a href="#readmemory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Read a single entry from memory.</p>
|
| 35 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 36 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Unique entry identifier</p>
|
| 37 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 38 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the read is happening (look-ahead guard)</p>
|
| 39 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></h4><p>Entry value</p>
|
| 40 |
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if entry not found</p>
|
| 41 |
+
</div></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.readMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24758">types.d.ts:24758</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="removememory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Memory</span><a href="#removememory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">removeMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Remove an entry from memory.</p>
|
| 42 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.removeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24743">types.d.ts:24743</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="searchmemory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>search<wbr/>Memory</span><a href="#searchmemory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">searchMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Search memory using BM25 full-text scoring.</p>
|
| 43 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 44 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Search query string</p>
|
| 45 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SearchSettings</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 46 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the search is happening (look-ahead guard)</p>
|
| 47 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Matching entries sorted by relevance score</p>
|
| 48 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.searchMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24710">types.d.ts:24710</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usedummy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Dummy</span><a href="#usedummy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useDummy</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to dummy adapter that discards all writes.</p>
|
| 49 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24777">types.d.ts:24777</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="uselocal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Local</span><a href="#uselocal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useLocal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to in-memory BM25 adapter (default).
|
| 50 |
All data lives in process memory only.</p>
|
| 51 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24768">types.d.ts:24768</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usememoryadapter" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Memory<wbr/>Adapter</span><a href="#usememoryadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useMemoryAdapter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to a custom memory adapter implementation.</p>
|
| 52 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom memory instance</p>
|
| 53 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24782">types.d.ts:24782</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usepersist" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Persist</span><a href="#usepersist" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">usePersist</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to file-system backed adapter.
|
| 54 |
Data is persisted to ./dump/memory/<signalId>/<bucketName>/.</p>
|
| 55 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24773">types.d.ts:24773</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="writememory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Memory</span><a href="#writememory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">writeMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">description</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">value</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Write a value to memory.</p>
|
| 56 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.writeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24694">types.d.ts:24694</a></li></ul></aside></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#clear" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a><a href="#disposesignal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a><a href="#listmemory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>list<wbr/>Memory</span></a><a href="#readmemory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>read<wbr/>Memory</span></a><a href="#removememory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>remove<wbr/>Memory</span></a><a href="#searchmemory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>search<wbr/>Memory</span></a><a href="#usedummy" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Dummy</span></a><a href="#uselocal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Local</span></a><a href="#usememoryadapter" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Memory<wbr/>Adapter</span></a><a href="#usepersist" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Persist</span></a><a href="#writememory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>write<wbr/>Memory</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 57 |
|
| 58 |
<!-- Yandex.Metrika counter -->
|
| 59 |
<script type="text/javascript">
|
classes/types.MemoryLiveAdapter.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
<li>Memoized instances per (signalId, bucketName) pair; cleared via disposeSignal() from MemoryAdapter</li>
|
| 9 |
</ul>
|
| 10 |
<p>Use this adapter for live trading memory storage.</p>
|
| 11 |
-
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TMemoryInstance</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 12 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MemoryLiveAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 13 |
<a href="types.MemoryLiveAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 14 |
<a href="types.MemoryLiveAdapter.html#listmemory" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>list<wbr/>Memory</span></a>
|
|
@@ -23,34 +23,37 @@
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormemoryliveadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MemoryLiveAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.MemoryLiveAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryLiveAdapter</a><a href="#constructormemoryliveadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.MemoryLiveAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryLiveAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 24 |
Call this when process.cwd() changes between strategy iterations
|
| 25 |
so new instances are created with the updated base path.</p>
|
| 26 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 27 |
Called by MemoryAdapter when a signal is cancelled or closed.</p>
|
| 28 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 29 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 30 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 31 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 32 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Array of all stored entries</p>
|
| 33 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.listMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 34 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span>
|
| 35 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Unique entry identifier</p>
|
| 36 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 37 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></h4><p>Entry value</p>
|
| 38 |
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if entry not found</p>
|
| 39 |
-
</div></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.readMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 40 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.removeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 41 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 42 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Search query string</p>
|
| 43 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SearchSettings</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 44 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Matching entries sorted by relevance score</p>
|
| 45 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.searchMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 46 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 47 |
All data lives in process memory only.</p>
|
| 48 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 49 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom memory instance</p>
|
| 50 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 51 |
Data is persisted to ./dump/memory/<signalId>/<bucketName>/.</p>
|
| 52 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 53 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.writeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 54 |
|
| 55 |
<!-- Yandex.Metrika counter -->
|
| 56 |
<script type="text/javascript">
|
|
|
|
| 8 |
<li>Memoized instances per (signalId, bucketName) pair; cleared via disposeSignal() from MemoryAdapter</li>
|
| 9 |
</ul>
|
| 10 |
<p>Use this adapter for live trading memory storage.</p>
|
| 11 |
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TMemoryInstance</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24802">types.d.ts:24802</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.MemoryLiveAdapter.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.MemoryLiveAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 13 |
<a href="types.MemoryLiveAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 14 |
<a href="types.MemoryLiveAdapter.html#listmemory" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>list<wbr/>Memory</span></a>
|
|
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructormemoryliveadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">MemoryLiveAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.MemoryLiveAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryLiveAdapter</a><a href="#constructormemoryliveadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.MemoryLiveAdapter.html" class="tsd-signature-type tsd-kind-class">MemoryLiveAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 24 |
Call this when process.cwd() changes between strategy iterations
|
| 25 |
so new instances are created with the updated base path.</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24914">types.d.ts:24914</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="disposesignal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose<wbr/>Signal</span><a href="#disposesignal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">disposeSignal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Disposes all memoized instances for the given signalId.
|
| 27 |
Called by MemoryAdapter when a signal is cancelled or closed.</p>
|
| 28 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 29 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24810">types.d.ts:24810</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="listmemory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>list<wbr/>Memory</span><a href="#listmemory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">listMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>List all entries in memory.</p>
|
| 30 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 31 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 32 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the list is happening (look-ahead guard)</p>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Array of all stored entries</p>
|
| 34 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.listMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24854">types.d.ts:24854</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="readmemory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Memory</span><a href="#readmemory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">readMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Read a single entry from memory.</p>
|
| 35 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 36 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Unique entry identifier</p>
|
| 37 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 38 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the read is happening (look-ahead guard)</p>
|
| 39 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">></span></h4><p>Entry value</p>
|
| 40 |
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if entry not found</p>
|
| 41 |
+
</div></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.readMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24884">types.d.ts:24884</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="removememory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Memory</span><a href="#removememory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">removeMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Remove an entry from memory.</p>
|
| 42 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.removeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24869">types.d.ts:24869</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="searchmemory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>search<wbr/>Memory</span><a href="#searchmemory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">searchMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Search memory using BM25 full-text scoring.</p>
|
| 43 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">SearchSettings</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 44 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">query</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Search query string</p>
|
| 45 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">settings</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SearchSettings</span></h5></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 46 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the search is happening (look-ahead guard)</p>
|
| 47 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">content</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">score</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Matching entries sorted by relevance score</p>
|
| 48 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.searchMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24836">types.d.ts:24836</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usedummy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Dummy</span><a href="#usedummy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useDummy</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to dummy adapter that discards all writes.</p>
|
| 49 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24903">types.d.ts:24903</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="uselocal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Local</span><a href="#uselocal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useLocal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to in-memory BM25 adapter.
|
| 50 |
All data lives in process memory only.</p>
|
| 51 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24894">types.d.ts:24894</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usememoryadapter" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Memory<wbr/>Adapter</span><a href="#usememoryadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useMemoryAdapter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to a custom memory adapter implementation.</p>
|
| 52 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TMemoryInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TMemoryInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom memory instance</p>
|
| 53 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24908">types.d.ts:24908</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usepersist" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Persist</span><a href="#usepersist" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">usePersist</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to file-system backed adapter (default).
|
| 54 |
Data is persisted to ./dump/memory/<signalId>/<bucketName>/.</p>
|
| 55 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24899">types.d.ts:24899</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="writememory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Memory</span><a href="#writememory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">writeMemory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> ��<span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">description</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">value</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">T</a><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Write a value to memory.</p>
|
| 56 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TMemoryInstance.writeMemory</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L24820">types.d.ts:24820</a></li></ul></aside></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#clear" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a><a href="#disposesignal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a><a href="#listmemory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>list<wbr/>Memory</span></a><a href="#readmemory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>read<wbr/>Memory</span></a><a href="#removememory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>remove<wbr/>Memory</span></a><a href="#searchmemory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>search<wbr/>Memory</span></a><a href="#usedummy" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Dummy</span></a><a href="#uselocal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Local</span></a><a href="#usememoryadapter" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Memory<wbr/>Adapter</span></a><a href="#usepersist" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Persist</span></a><a href="#writememory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>write<wbr/>Memory</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 57 |
|
| 58 |
<!-- Yandex.Metrika counter -->
|
| 59 |
<script type="text/javascript">
|
classes/types.Performance.html
CHANGED
|
@@ -6,10 +6,10 @@
|
|
| 6 |
<li>Save reports to disk</li>
|
| 7 |
<li>Clear accumulated metrics</li>
|
| 8 |
</ul>
|
| 9 |
-
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-
|
| 10 |
</code><button type="button">Copy</button></pre>
|
| 11 |
|
| 12 |
-
</div></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 13 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.Performance.html#dump" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dump</span></a>
|
| 14 |
<a href="types.Performance.html#getdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Data</span></a>
|
| 15 |
<a href="types.Performance.html#getreport" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Report</span></a>
|
|
@@ -19,10 +19,10 @@ Default path: ./dump/performance/{strategyName}.md</p>
|
|
| 19 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 20 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Optional custom directory path</p>
|
| 21 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">columns</span>: <span class="tsd-signature-type">Columns$8</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Optional columns configuration for the report</p>
|
| 22 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-1" class="tsd-anchor"></a>Example<a href="#example-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">// Save to default path: ./dump/performance/my-strategy.md</span><br/><span class="hl-
|
| 23 |
</code><button type="button">Copy</button></pre>
|
| 24 |
|
| 25 |
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 26 |
<p>Returns detailed metrics grouped by operation type:</p>
|
| 27 |
<ul>
|
| 28 |
<li>Count, total duration, average, min, max</li>
|
|
@@ -31,10 +31,10 @@ Default path: ./dump/performance/{strategyName}.md</p>
|
|
| 31 |
</ul>
|
| 32 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.PerformanceStatisticsModel.html" class="tsd-signature-type tsd-kind-interface">PerformanceStatisticsModel</a><span class="tsd-signature-symbol">></span></h4><p>Performance statistics with aggregated metrics</p>
|
| 34 |
-
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-2" class="tsd-anchor"></a>Example<a href="#example-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">stats</span><span class="hl-1"> = </span><span class="hl-
|
| 35 |
</code><button type="button">Copy</button></pre>
|
| 36 |
|
| 37 |
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 38 |
<p>Report includes:</p>
|
| 39 |
<ul>
|
| 40 |
<li>Time distribution across operation types</li>
|
|
@@ -44,10 +44,10 @@ Default path: ./dump/performance/{strategyName}.md</p>
|
|
| 44 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 45 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">columns</span>: <span class="tsd-signature-type">Columns$8</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Optional columns configuration for the report</p>
|
| 46 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><p>Markdown formatted report string</p>
|
| 47 |
-
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-3" class="tsd-anchor"></a>Example<a href="#example-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">markdown</span><span class="hl-1"> = </span><span class="hl-
|
| 48 |
</code><button type="button">Copy</button></pre>
|
| 49 |
|
| 50 |
-
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 51 |
|
| 52 |
<!-- Yandex.Metrika counter -->
|
| 53 |
<script type="text/javascript">
|
|
|
|
| 6 |
<li>Save reports to disk</li>
|
| 7 |
<li>Clear accumulated metrics</li>
|
| 8 |
</ul>
|
| 9 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">Performance</span><span class="hl-1">, </span><span class="hl-4">listenPerformance</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Subscribe to performance events</span><br/><span class="hl-0">listenPerformance</span><span class="hl-1">((</span><span class="hl-4">event</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`</span><span class="hl-3">${</span><span class="hl-4">event</span><span class="hl-9">.</span><span class="hl-4">metricType</span><span class="hl-3">}</span><span class="hl-2">: </span><span class="hl-3">${</span><span class="hl-4">event</span><span class="hl-9">.</span><span class="hl-4">duration</span><span class="hl-9">.</span><span class="hl-0">toFixed</span><span class="hl-9">(</span><span class="hl-7">2</span><span class="hl-9">)</span><span class="hl-3">}</span><span class="hl-2">ms`</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Run bt...</span><br/><br/><span class="hl-6">// Get aggregated statistics</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">stats</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Performance</span><span class="hl-1">.</span><span class="hl-0">getData</span><span class="hl-1">(</span><span class="hl-2">"my-strategy"</span><span class="hl-1">);</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">"Total time:"</span><span class="hl-1">, </span><span class="hl-4">stats</span><span class="hl-1">.</span><span class="hl-4">totalDuration</span><span class="hl-1">);</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">"Slowest operations:"</span><span class="hl-1">, </span><span class="hl-4">Object</span><span class="hl-1">.</span><span class="hl-0">values</span><span class="hl-1">(</span><span class="hl-4">stats</span><span class="hl-1">.</span><span class="hl-4">metricStats</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">sort</span><span class="hl-1">((</span><span class="hl-4">a</span><span class="hl-1">, </span><span class="hl-4">b</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">b</span><span class="hl-1">.</span><span class="hl-4">avgDuration</span><span class="hl-1"> - </span><span class="hl-4">a</span><span class="hl-1">.</span><span class="hl-4">avgDuration</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">slice</span><span class="hl-1">(</span><span class="hl-7">0</span><span class="hl-1">, </span><span class="hl-7">5</span><span class="hl-1">));</span><br/><br/><span class="hl-6">// Generate and save report</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Performance</span><span class="hl-1">.</span><span class="hl-0">dump</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">);</span>
|
| 10 |
</code><button type="button">Copy</button></pre>
|
| 11 |
|
| 12 |
+
</div></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L20490">types.d.ts:20490</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.Performance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 13 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.Performance.html#dump" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dump</span></a>
|
| 14 |
<a href="types.Performance.html#getdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Data</span></a>
|
| 15 |
<a href="types.Performance.html#getreport" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Report</span></a>
|
|
|
|
| 19 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 20 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">path</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Optional custom directory path</p>
|
| 21 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">columns</span>: <span class="tsd-signature-type">Columns$8</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Optional columns configuration for the report</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-1" class="tsd-anchor"></a>Example<a href="#example-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">// Save to default path: ./dump/performance/my-strategy.md</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Performance</span><span class="hl-1">.</span><span class="hl-0">dump</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Save to custom path: ./reports/perf/my-strategy.md</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Performance</span><span class="hl-1">.</span><span class="hl-0">dump</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">, </span><span class="hl-2">"./reports/perf"</span><span class="hl-1">);</span>
|
| 23 |
</code><button type="button">Copy</button></pre>
|
| 24 |
|
| 25 |
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L20573">types.d.ts:20573</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="getdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>get<wbr/>Data</span><a href="#getdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getData</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">context</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">backtest</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.PerformanceStatisticsModel.html" class="tsd-signature-type tsd-kind-interface">PerformanceStatisticsModel</a><span class="tsd-signature-symbol">></span><a href="#getdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets aggregated performance statistics for a symbol-strategy pair.</p>
|
| 26 |
<p>Returns detailed metrics grouped by operation type:</p>
|
| 27 |
<ul>
|
| 28 |
<li>Count, total duration, average, min, max</li>
|
|
|
|
| 31 |
</ul>
|
| 32 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.PerformanceStatisticsModel.html" class="tsd-signature-type tsd-kind-interface">PerformanceStatisticsModel</a><span class="tsd-signature-symbol">></span></h4><p>Performance statistics with aggregated metrics</p>
|
| 34 |
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-2" class="tsd-anchor"></a>Example<a href="#example-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">stats</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Performance</span><span class="hl-1">.</span><span class="hl-0">getData</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Find slowest operation type</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">slowest</span><span class="hl-1"> = </span><span class="hl-4">Object</span><span class="hl-1">.</span><span class="hl-0">values</span><span class="hl-1">(</span><span class="hl-4">stats</span><span class="hl-1">.</span><span class="hl-4">metricStats</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">sort</span><span class="hl-1">((</span><span class="hl-4">a</span><span class="hl-1">, </span><span class="hl-4">b</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">b</span><span class="hl-1">.</span><span class="hl-4">avgDuration</span><span class="hl-1"> - </span><span class="hl-4">a</span><span class="hl-1">.</span><span class="hl-4">avgDuration</span><span class="hl-1">)[</span><span class="hl-7">0</span><span class="hl-1">];</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Slowest: </span><span class="hl-3">${</span><span class="hl-4">slowest</span><span class="hl-9">.</span><span class="hl-4">metricType</span><span class="hl-3">}</span><span class="hl-2"> (</span><span class="hl-3">${</span><span class="hl-4">slowest</span><span class="hl-9">.</span><span class="hl-4">avgDuration</span><span class="hl-9">.</span><span class="hl-0">toFixed</span><span class="hl-9">(</span><span class="hl-7">2</span><span class="hl-9">)</span><span class="hl-3">}</span><span class="hl-2">ms avg)`</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Check for outliers</span><br/><span class="hl-5">for</span><span class="hl-1"> (</span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">metric</span><span class="hl-1"> </span><span class="hl-3">of</span><span class="hl-1"> </span><span class="hl-4">Object</span><span class="hl-1">.</span><span class="hl-0">values</span><span class="hl-1">(</span><span class="hl-4">stats</span><span class="hl-1">.</span><span class="hl-4">metricStats</span><span class="hl-1">)) {</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">metric</span><span class="hl-1">.</span><span class="hl-4">p99</span><span class="hl-1"> > </span><span class="hl-4">metric</span><span class="hl-1">.</span><span class="hl-4">avgDuration</span><span class="hl-1"> * </span><span class="hl-7">5</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">warn</span><span class="hl-1">(</span><span class="hl-2">`High variance in </span><span class="hl-3">${</span><span class="hl-4">metric</span><span class="hl-9">.</span><span class="hl-4">metricType</span><span class="hl-3">}</span><span class="hl-2">: P99=</span><span class="hl-3">${</span><span class="hl-4">metric</span><span class="hl-9">.</span><span class="hl-4">p99</span><span class="hl-3">}</span><span class="hl-2">ms, Avg=</span><span class="hl-3">${</span><span class="hl-4">metric</span><span class="hl-9">.</span><span class="hl-4">avgDuration</span><span class="hl-3">}</span><span class="hl-2">ms`</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 35 |
</code><button type="button">Copy</button></pre>
|
| 36 |
|
| 37 |
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L20520">types.d.ts:20520</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="getreport" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>get<wbr/>Report</span><a href="#getreport" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getreport-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getReport</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">context</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">backtest</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">columns</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">Columns$8</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><a href="#getreport-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Generates markdown report with performance analysis.</p>
|
| 38 |
<p>Report includes:</p>
|
| 39 |
<ul>
|
| 40 |
<li>Time distribution across operation types</li>
|
|
|
|
| 44 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 45 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">columns</span>: <span class="tsd-signature-type">Columns$8</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Optional columns configuration for the report</p>
|
| 46 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><p>Markdown formatted report string</p>
|
| 47 |
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-3" class="tsd-anchor"></a>Example<a href="#example-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">markdown</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Performance</span><span class="hl-1">.</span><span class="hl-0">getReport</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">);</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-4">markdown</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Or save to file</span><br/><span class="hl-5">import</span><span class="hl-1"> </span><span class="hl-4">fs</span><span class="hl-1"> </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"fs/promises"</span><span class="hl-1">;</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">fs</span><span class="hl-1">.</span><span class="hl-0">writeFile</span><span class="hl-1">(</span><span class="hl-2">"performance-report.md"</span><span class="hl-1">, </span><span class="hl-4">markdown</span><span class="hl-1">);</span>
|
| 48 |
</code><button type="button">Copy</button></pre>
|
| 49 |
|
| 50 |
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L20548">types.d.ts:20548</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#dump" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dump</span></a><a href="#getdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Data</span></a><a href="#getreport" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Report</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 51 |
|
| 52 |
<!-- Yandex.Metrika counter -->
|
| 53 |
<script type="text/javascript">
|
classes/types.PersistBase.html
CHANGED
|
@@ -6,10 +6,10 @@
|
|
| 6 |
<li>Async generator support for iteration</li>
|
| 7 |
<li>Retry logic for file deletion</li>
|
| 8 |
</ul>
|
| 9 |
-
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">persist</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistBase</span><span class="hl-1">(</span><span class="hl-2">"my-entity"</span><span class="hl-1">, </span><span class="hl-2">"./data"</span><span class="hl-1">);</span><br/><span class="hl-
|
| 10 |
</code><button type="button">Copy</button></pre>
|
| 11 |
|
| 12 |
-
</div></div></section> <section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="entityname" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">EntityName</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span> = <span class="tsd-signature-type">string</span></span></li></ul></section> <section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistBase.html" class="tsd-signature-type tsd-kind-interface">IPersistBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 13 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistBase.html#_directory" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_directory</span></a>
|
| 14 |
<a href="types.PersistBase.html#base_wait_for_init_symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[BASE_<wbr/>WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span></a>
|
| 15 |
<a href="types.PersistBase.html#basedir" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>base<wbr/>Dir</span></a>
|
|
@@ -23,32 +23,32 @@
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistbase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistBase</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">entityName</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">baseDir</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistBase.html" class="tsd-signature-type tsd-kind-class">PersistBase</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a><span class="tsd-signature-symbol">></span><a href="#constructorpersistbase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new persistence instance.</p>
|
| 24 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="constructorpersistbaseentityname" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">EntityName</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span> = <span class="tsd-signature-type">string</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityName</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a></span><div class="tsd-comment tsd-typography"><p>Unique entity type identifier</p>
|
| 25 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">baseDir</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Base directory for all entities (default: ./dump/data)</p>
|
| 26 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistBase.html" class="tsd-signature-type tsd-kind-class">PersistBase</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 27 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 28 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Entity identifier</p>
|
| 29 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>Full file path to entity JSON file</p>
|
| 30 |
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 31 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Unique entity identifier</p>
|
| 32 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to true if exists, false otherwise</p>
|
| 33 |
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#hasvalue">hasValue</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 34 |
Sorted alphanumerically.
|
| 35 |
Used internally by waitForInit for validation.</p>
|
| 36 |
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a><span class="tsd-signature-symbol">></span></h4><p>AsyncGenerator yielding entity IDs</p>
|
| 37 |
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if reading fails</p>
|
| 38 |
-
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#keys">keys</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 39 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="readvaluet" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">IEntity</span> = <span class="tsd-signature-type">IEntity</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Unique entity identifier</p>
|
| 40 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#readvaluet">T</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to entity data</p>
|
| 41 |
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws-1" class="tsd-anchor"></a>Throws<a href="#throws-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if entity not found or read fails</p>
|
| 42 |
-
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#readvalue">readValue</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 43 |
Uses singleshot to ensure one-time execution.</p>
|
| 44 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 45 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 46 |
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 47 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="writevaluet" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">IEntity</span> = <span class="tsd-signature-type">IEntity</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Unique entity identifier</p>
|
| 48 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">entity</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#writevaluet">T</a></span><div class="tsd-comment tsd-typography"><p>Entity data to persist</p>
|
| 49 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 50 |
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws-2" class="tsd-anchor"></a>Throws<a href="#throws-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if write fails</p>
|
| 51 |
-
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#writevalue">writeValue</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 52 |
|
| 53 |
<!-- Yandex.Metrika counter -->
|
| 54 |
<script type="text/javascript">
|
|
|
|
| 6 |
<li>Async generator support for iteration</li>
|
| 7 |
<li>Retry logic for file deletion</li>
|
| 8 |
</ul>
|
| 9 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">persist</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistBase</span><span class="hl-1">(</span><span class="hl-2">"my-entity"</span><span class="hl-1">, </span><span class="hl-2">"./data"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">persist</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">persist</span><span class="hl-1">.</span><span class="hl-0">writeValue</span><span class="hl-1">(</span><span class="hl-2">"key1"</span><span class="hl-1">, { </span><span class="hl-4">data:</span><span class="hl-1"> </span><span class="hl-2">"value"</span><span class="hl-1"> });</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">value</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">persist</span><span class="hl-1">.</span><span class="hl-0">readValue</span><span class="hl-1">(</span><span class="hl-2">"key1"</span><span class="hl-1">);</span>
|
| 10 |
</code><button type="button">Copy</button></pre>
|
| 11 |
|
| 12 |
+
</div></div></section> <section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="entityname" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">EntityName</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span> = <span class="tsd-signature-type">string</span></span></li></ul></section> <section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistBase.html" class="tsd-signature-type tsd-kind-interface">IPersistBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13067">types.d.ts:13067</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistBase.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 13 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistBase.html#_directory" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_directory</span></a>
|
| 14 |
<a href="types.PersistBase.html#base_wait_for_init_symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[BASE_<wbr/>WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span></a>
|
| 15 |
<a href="types.PersistBase.html#basedir" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>base<wbr/>Dir</span></a>
|
|
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistbase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistBase</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">entityName</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">baseDir</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistBase.html" class="tsd-signature-type tsd-kind-class">PersistBase</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a><span class="tsd-signature-symbol">></span><a href="#constructorpersistbase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new persistence instance.</p>
|
| 24 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="constructorpersistbaseentityname" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">EntityName</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">string</span> = <span class="tsd-signature-type">string</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityName</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a></span><div class="tsd-comment tsd-typography"><p>Unique entity type identifier</p>
|
| 25 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">baseDir</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Base directory for all entities (default: ./dump/data)</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistBase.html" class="tsd-signature-type tsd-kind-class">PersistBase</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13078">types.d.ts:13078</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="_directory" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_directory</span><a href="#_directory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">_directory</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>Computed directory path for entity storage</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13071">types.d.ts:13071</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="base_wait_for_init_symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>[BASE_<wbr/>WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span><a href="#base_wait_for_init_symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">"[BASE_WAIT_FOR_INIT_SYMBOL]"</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">&</span> <span class="tsd-signature-type">ISingleshotClearable</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13086">types.d.ts:13086</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="basedir" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>base<wbr/>Dir</span><a href="#basedir" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">baseDir</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13069">types.d.ts:13069</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="entityname-1" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>entity<wbr/>Name</span><a href="#entityname-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">entityName</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#constructorpersistbaseentityname">EntityName</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13068">types.d.ts:13068</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="_getfilepath" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_get<wbr/>File<wbr/>Path</span><a href="#_getfilepath" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="_getfilepath-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">_getFilePath</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">entityId</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#_getfilepath-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Computes file path for entity ID.</p>
|
| 28 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Entity identifier</p>
|
| 29 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>Full file path to entity JSON file</p>
|
| 30 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13085">types.d.ts:13085</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="hasvalue" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>has<wbr/>Value</span><a href="#hasvalue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="hasvalue-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">hasValue</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">entityId</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#hasvalue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Check if entity exists in storage.</p>
|
| 31 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Unique entity identifier</p>
|
| 32 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to true if exists, false otherwise</p>
|
| 33 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#hasvalue">hasValue</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13089">types.d.ts:13089</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="keys" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>keys</span><a href="#keys" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="keys-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">keys</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a><span class="tsd-signature-symbol">></span><a href="#keys-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Async generator yielding all entity IDs.
|
| 34 |
Sorted alphanumerically.
|
| 35 |
Used internally by waitForInit for validation.</p>
|
| 36 |
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a><span class="tsd-signature-symbol">></span></h4><p>AsyncGenerator yielding entity IDs</p>
|
| 37 |
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if reading fails</p>
|
| 38 |
+
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#keys">keys</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13099">types.d.ts:13099</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="readvalue" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Value</span><a href="#readvalue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readvalue-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readValue</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#readvaluet">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">IEntity</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">IEntity</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">entityId</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#readvaluet">T</a><span class="tsd-signature-symbol">></span><a href="#readvalue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Read entity from persistence storage.</p>
|
| 39 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="readvaluet" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">IEntity</span> = <span class="tsd-signature-type">IEntity</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Unique entity identifier</p>
|
| 40 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#readvaluet">T</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to entity data</p>
|
| 41 |
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws-1" class="tsd-anchor"></a>Throws<a href="#throws-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if entity not found or read fails</p>
|
| 42 |
+
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#readvalue">readValue</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13088">types.d.ts:13088</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initialize persistence directory and validate existing files.
|
| 43 |
Uses singleshot to ensure one-time execution.</p>
|
| 44 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 45 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 46 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13087">types.d.ts:13087</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writevalue" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Value</span><a href="#writevalue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writevalue-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeValue</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#writevaluet">T</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">IEntity</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">IEntity</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">entityId</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">entity</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#writevaluet">T</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writevalue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Write entity to storage with atomic file writes.</p>
|
| 47 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="writevaluet" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">IEntity</span> = <span class="tsd-signature-type">IEntity</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">entityId</span>: <a href="../types/types.EntityId.html" class="tsd-signature-type tsd-kind-type-alias">EntityId</a></span><div class="tsd-comment tsd-typography"><p>Unique entity identifier</p>
|
| 48 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">entity</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="types.PersistBase.html#writevaluet">T</a></span><div class="tsd-comment tsd-typography"><p>Entity data to persist</p>
|
| 49 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 50 |
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws-2" class="tsd-anchor"></a>Throws<a href="#throws-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if write fails</p>
|
| 51 |
+
</div></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBase.html">IPersistBase</a>.<a href="../interfaces/types.IPersistBase.html#writevalue">writeValue</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13090">types.d.ts:13090</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#_directory" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_directory</span></a><a href="#base_wait_for_init_symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[BASE_<wbr/>WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span></a><a href="#basedir" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>base<wbr/>Dir</span></a><a href="#entityname-1" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>entity<wbr/>Name</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#_getfilepath" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>_get<wbr/>File<wbr/>Path</span></a><a href="#hasvalue" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>has<wbr/>Value</span></a><a href="#keys" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>keys</span></a><a href="#readvalue" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Value</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writevalue" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Value</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 52 |
|
| 53 |
<!-- Yandex.Metrika counter -->
|
| 54 |
<script type="text/javascript">
|
classes/types.PersistBreakevenInstance.html
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistBreakevenInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistBreakevenInstance.html">PersistBreakevenInstance</a></li></ul><h1>Class PersistBreakevenInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistBreakevenInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses signalId as entity ID within a per-context PersistBase</li>
|
| 6 |
+
<li>Crash-safe via atomic writes</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistBreakevenInstance</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeBreakevenData</span><span class="hl-1">(</span><span class="hl-4">breakevenData</span><span class="hl-1">, </span><span class="hl-2">"signal-id-1"</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">restored</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readBreakevenData</span><span class="hl-1">(</span><span class="hl-2">"signal-id-1"</span><span class="hl-1">);</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistBreakevenInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistBreakevenInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13852">types.d.ts:13852</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistBreakevenInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistBreakevenInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 13 |
+
<a href="types.PersistBreakevenInstance.html#strategyname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistBreakevenInstance.html#symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a>
|
| 15 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistBreakevenInstance.html#readbreakevendata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Breakeven<wbr/>Data</span></a>
|
| 16 |
+
<a href="types.PersistBreakevenInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
+
<a href="types.PersistBreakevenInstance.html#writebreakevendata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Breakeven<wbr/>Data</span></a>
|
| 18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistbreakeveninstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistBreakevenInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistBreakevenInstance.html" class="tsd-signature-type tsd-kind-class">PersistBreakevenInstance</a><a href="#constructorpersistbreakeveninstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new breakeven persistence instance.</p>
|
| 19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">strategyName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Strategy identifier</p>
|
| 21 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistBreakevenInstance.html" class="tsd-signature-type tsd-kind-class">PersistBreakevenInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13865">types.d.ts:13865</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13855">types.d.ts:13855</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="strategyname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>strategy<wbr/>Name</span><a href="#strategyname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13854">types.d.ts:13854</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>symbol</span><a href="#symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13853">types.d.ts:13853</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readbreakevendata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Breakeven<wbr/>Data</span><a href="#readbreakevendata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readbreakevendata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readBreakevenData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.BreakevenData.html" class="tsd-signature-type tsd-kind-type-alias">BreakevenData</a><span class="tsd-signature-symbol">></span><a href="#readbreakevendata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the breakeven data for the given signal using <code>signalId</code> as the entity key.</p>
|
| 23 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 24 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.BreakevenData.html" class="tsd-signature-type tsd-kind-type-alias">BreakevenData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to breakeven data record (empty object if not found)</p>
|
| 25 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBreakevenInstance.html">IPersistBreakevenInstance</a>.<a href="../interfaces/types.IPersistBreakevenInstance.html#readbreakevendata">readBreakevenData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13879">types.d.ts:13879</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 26 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBreakevenInstance.html">IPersistBreakevenInstance</a>.<a href="../interfaces/types.IPersistBreakevenInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13872">types.d.ts:13872</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writebreakevendata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Breakeven<wbr/>Data</span><a href="#writebreakevendata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writebreakevendata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeBreakevenData</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.BreakevenData.html" class="tsd-signature-type tsd-kind-type-alias">BreakevenData</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writebreakevendata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the breakeven data for the given signal using <code>signalId</code> as the entity key.</p>
|
| 29 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a href="../types/types.BreakevenData.html" class="tsd-signature-type tsd-kind-type-alias">BreakevenData</a></span><div class="tsd-comment tsd-typography"><p>Breakeven data record to persist</p>
|
| 30 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 31 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 32 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistBreakevenInstance.html">IPersistBreakevenInstance</a>.<a href="../interfaces/types.IPersistBreakevenInstance.html#writebreakevendata">writeBreakevenData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13888">types.d.ts:13888</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#strategyname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a><a href="#symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readbreakevendata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Breakeven<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writebreakevendata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Breakeven<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 33 |
+
|
| 34 |
+
<!-- Yandex.Metrika counter -->
|
| 35 |
+
<script type="text/javascript">
|
| 36 |
+
(function(m,e,t,r,i,k,a){
|
| 37 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 38 |
+
m[i].l=1*new Date();
|
| 39 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 40 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 41 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 42 |
+
|
| 43 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 44 |
+
</script>
|
| 45 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 46 |
+
<!-- /Yandex.Metrika counter -->
|
| 47 |
+
|
| 48 |
+
<!-- Google tag (gtag.js) -->
|
| 49 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 50 |
+
<script>
|
| 51 |
+
window.dataLayer = window.dataLayer || [];
|
| 52 |
+
function gtag(){dataLayer.push(arguments);}
|
| 53 |
+
gtag('js', new Date());
|
| 54 |
+
|
| 55 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 56 |
+
</script>
|
classes/types.PersistCandleInstance.html
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistCandleInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistCandleInstance.html">PersistCandleInstance</a></li></ul><h1>Class PersistCandleInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistCandleInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Each candle stored as a separate JSON file keyed by its timestamp</li>
|
| 5 |
+
<li>Read returns null on any missing timestamp (cache miss → refetch)</li>
|
| 6 |
+
<li>Write skips incomplete candles (closeTime > now) and existing keys</li>
|
| 7 |
+
<li>Invalid cached candles emit warnings via errorEmitter and treated as miss</li>
|
| 8 |
+
</ul>
|
| 9 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistCandleInstance</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"1m"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeCandlesData</span><span class="hl-1">(</span><span class="hl-4">candles</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">cached</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readCandlesData</span><span class="hl-1">(</span><span class="hl-7">100</span><span class="hl-1">, </span><span class="hl-4">since</span><span class="hl-1">, </span><span class="hl-4">until</span><span class="hl-1">);</span>
|
| 10 |
+
</code><button type="button">Copy</button></pre>
|
| 11 |
+
|
| 12 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistCandleInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistCandleInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14061">types.d.ts:14061</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistCandleInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistCandleInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistCandleInstance.html#interval" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>interval</span></a>
|
| 15 |
+
<a href="types.PersistCandleInstance.html#symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a>
|
| 16 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistCandleInstance.html#readcandlesdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Candles<wbr/>Data</span></a>
|
| 17 |
+
<a href="types.PersistCandleInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 18 |
+
<a href="types.PersistCandleInstance.html#writecandlesdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Candles<wbr/>Data</span></a>
|
| 19 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistcandleinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistCandleInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">interval</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.CandleInterval.html" class="tsd-signature-type tsd-kind-type-alias">CandleInterval</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistCandleInstance.html" class="tsd-signature-type tsd-kind-class">PersistCandleInstance</a><a href="#constructorpersistcandleinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new candle cache persistence instance.</p>
|
| 20 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 21 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">interval</span>: <a href="../types/types.CandleInterval.html" class="tsd-signature-type tsd-kind-type-alias">CandleInterval</a></span><div class="tsd-comment tsd-typography"><p>Candle interval (1m, 5m, 1h, etc.)</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 23 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistCandleInstance.html" class="tsd-signature-type tsd-kind-class">PersistCandleInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14074">types.d.ts:14074</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14064">types.d.ts:14064</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="interval" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>interval</span><a href="#interval" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">interval</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.CandleInterval.html" class="tsd-signature-type tsd-kind-type-alias">CandleInterval</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14063">types.d.ts:14063</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>symbol</span><a href="#symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14062">types.d.ts:14062</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readcandlesdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Candles<wbr/>Data</span><a href="#readcandlesdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readcandlesdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readCandlesData</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">limit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">sinceTimestamp</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">_untilTimestamp</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.ICandleData.html" class="tsd-signature-type tsd-kind-interface">ICandleData</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#readcandlesdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads cached candles for the requested window.
|
| 24 |
+
Computes expected timestamps (sinceTimestamp + i * stepMs) and reads each
|
| 25 |
+
by timestamp key. Returns null on ANY missing timestamp (cache miss).
|
| 26 |
+
Invalid cached candles emit a warning via errorEmitter and are treated as miss.</p>
|
| 27 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">limit</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>Number of candles requested</p>
|
| 28 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">sinceTimestamp</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>Aligned start timestamp (openTime of first candle)</p>
|
| 29 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_untilTimestamp</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>Reserved for API compatibility, unused</p>
|
| 30 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.ICandleData.html" class="tsd-signature-type tsd-kind-interface">ICandleData</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to candles in order, or null on cache miss</p>
|
| 31 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistCandleInstance.html">IPersistCandleInstance</a>.<a href="../interfaces/types.IPersistCandleInstance.html#readcandlesdata">readCandlesData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14093">types.d.ts:14093</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 32 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 33 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 34 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistCandleInstance.html">IPersistCandleInstance</a>.<a href="../interfaces/types.IPersistCandleInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14081">types.d.ts:14081</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writecandlesdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Candles<wbr/>Data</span><a href="#writecandlesdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writecandlesdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeCandlesData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">candles</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.ICandleData.html" class="tsd-signature-type tsd-kind-interface">ICandleData</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writecandlesdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes candles to cache.
|
| 35 |
+
Skips incomplete candles (closeTime > now) and existing keys to keep
|
| 36 |
+
the cache append-only for fully closed candles.</p>
|
| 37 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">candles</span>: <a href="../interfaces/types.ICandleData.html" class="tsd-signature-type tsd-kind-interface">ICandleData</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Array of candle data to cache</p>
|
| 38 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when all writes are complete</p>
|
| 39 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistCandleInstance.html">IPersistCandleInstance</a>.<a href="../interfaces/types.IPersistCandleInstance.html#writecandlesdata">writeCandlesData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14102">types.d.ts:14102</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#interval" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>interval</span></a><a href="#symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readcandlesdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Candles<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writecandlesdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Candles<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 40 |
+
|
| 41 |
+
<!-- Yandex.Metrika counter -->
|
| 42 |
+
<script type="text/javascript">
|
| 43 |
+
(function(m,e,t,r,i,k,a){
|
| 44 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 45 |
+
m[i].l=1*new Date();
|
| 46 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 47 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 48 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 49 |
+
|
| 50 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 51 |
+
</script>
|
| 52 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 53 |
+
<!-- /Yandex.Metrika counter -->
|
| 54 |
+
|
| 55 |
+
<!-- Google tag (gtag.js) -->
|
| 56 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 57 |
+
<script>
|
| 58 |
+
window.dataLayer = window.dataLayer || [];
|
| 59 |
+
function gtag(){dataLayer.push(arguments);}
|
| 60 |
+
gtag('js', new Date());
|
| 61 |
+
|
| 62 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 63 |
+
</script>
|
classes/types.PersistIntervalInstance.html
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistIntervalInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistIntervalInstance.html">PersistIntervalInstance</a></li></ul><h1>Class PersistIntervalInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistIntervalInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Soft delete via <code>removed: true</code> flag</li>
|
| 6 |
+
<li>listIntervalData filters out removed markers</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistIntervalInstance</span><span class="hl-1">(</span><span class="hl-2">"my-interval-bucket"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeIntervalData</span><span class="hl-1">({ </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">"x"</span><span class="hl-1">, </span><span class="hl-4">data:</span><span class="hl-1"> {}, </span><span class="hl-4">removed:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1"> }, </span><span class="hl-2">"key1"</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">marker</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readIntervalData</span><span class="hl-1">(</span><span class="hl-2">"key1"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">removeIntervalData</span><span class="hl-1">(</span><span class="hl-2">"key1"</span><span class="hl-1">);</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistIntervalInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistIntervalInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14930">types.d.ts:14930</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistIntervalInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistIntervalInstance.html#bucket" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket</span></a>
|
| 13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistIntervalInstance.html#listintervaldata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Interval<wbr/>Data</span></a>
|
| 14 |
+
<a href="types.PersistIntervalInstance.html#readintervaldata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Interval<wbr/>Data</span></a>
|
| 15 |
+
<a href="types.PersistIntervalInstance.html#removeintervaldata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Interval<wbr/>Data</span></a>
|
| 16 |
+
<a href="types.PersistIntervalInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
+
<a href="types.PersistIntervalInstance.html#writeintervaldata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Interval<wbr/>Data</span></a>
|
| 18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistintervalinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistIntervalInstance</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">bucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistIntervalInstance.html" class="tsd-signature-type tsd-kind-class">PersistIntervalInstance</a><a href="#constructorpersistintervalinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new interval marker persistence instance.</p>
|
| 19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">bucket</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Marker bucket identifier</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistIntervalInstance.html" class="tsd-signature-type tsd-kind-class">PersistIntervalInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14939">types.d.ts:14939</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="bucket" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>bucket</span><a href="#bucket" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14931">types.d.ts:14931</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="listintervaldata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>list<wbr/>Interval<wbr/>Data</span><a href="#listintervaldata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="listintervaldata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listIntervalData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><a href="#listintervaldata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Iterates all markers in the bucket, yielding keys of non-removed markers only.</p>
|
| 21 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><p>AsyncGenerator yielding marker keys</p>
|
| 22 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistIntervalInstance.html">IPersistIntervalInstance</a>.<a href="../interfaces/types.IPersistIntervalInstance.html#listintervaldata">listIntervalData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14975">types.d.ts:14975</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="readintervaldata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Interval<wbr/>Data</span><a href="#readintervaldata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readintervaldata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readIntervalData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.IntervalData.html" class="tsd-signature-type tsd-kind-type-alias">IntervalData</a><span class="tsd-signature-symbol">></span><a href="#readintervaldata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads an interval marker by key. Returns null if marker is missing or soft-deleted.</p>
|
| 23 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Marker key within the bucket</p>
|
| 24 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.IntervalData.html" class="tsd-signature-type tsd-kind-type-alias">IntervalData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to stored data, or null</p>
|
| 25 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistIntervalInstance.html">IPersistIntervalInstance</a>.<a href="../interfaces/types.IPersistIntervalInstance.html#readintervaldata">readIntervalData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14953">types.d.ts:14953</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="removeintervaldata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Interval<wbr/>Data</span><a href="#removeintervaldata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="removeintervaldata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">removeIntervalData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#removeintervaldata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Soft-deletes a marker by writing <code>removed: true</code> flag while preserving the file.
|
| 26 |
+
Subsequent reads will return null, allowing the interval to fire again.</p>
|
| 27 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Marker key within the bucket</p>
|
| 28 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when removal is complete</p>
|
| 29 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistIntervalInstance.html">IPersistIntervalInstance</a>.<a href="../interfaces/types.IPersistIntervalInstance.html#removeintervaldata">removeIntervalData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14969">types.d.ts:14969</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 30 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 31 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 32 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistIntervalInstance.html">IPersistIntervalInstance</a>.<a href="../interfaces/types.IPersistIntervalInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14946">types.d.ts:14946</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writeintervaldata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Interval<wbr/>Data</span><a href="#writeintervaldata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writeintervaldata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeIntervalData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.IntervalData.html" class="tsd-signature-type tsd-kind-type-alias">IntervalData</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writeintervaldata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes an interval marker under the given key.</p>
|
| 33 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a href="../types/types.IntervalData.html" class="tsd-signature-type tsd-kind-type-alias">IntervalData</a></span><div class="tsd-comment tsd-typography"><p>Data to store</p>
|
| 34 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Marker key within the bucket</p>
|
| 35 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 36 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistIntervalInstance.html">IPersistIntervalInstance</a>.<a href="../interfaces/types.IPersistIntervalInstance.html#writeintervaldata">writeIntervalData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14961">types.d.ts:14961</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#bucket" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#listintervaldata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Interval<wbr/>Data</span></a><a href="#readintervaldata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Interval<wbr/>Data</span></a><a href="#removeintervaldata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Interval<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writeintervaldata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Interval<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 37 |
+
|
| 38 |
+
<!-- Yandex.Metrika counter -->
|
| 39 |
+
<script type="text/javascript">
|
| 40 |
+
(function(m,e,t,r,i,k,a){
|
| 41 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 42 |
+
m[i].l=1*new Date();
|
| 43 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 44 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 45 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 46 |
+
|
| 47 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 48 |
+
</script>
|
| 49 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 50 |
+
<!-- /Yandex.Metrika counter -->
|
| 51 |
+
|
| 52 |
+
<!-- Google tag (gtag.js) -->
|
| 53 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 54 |
+
<script>
|
| 55 |
+
window.dataLayer = window.dataLayer || [];
|
| 56 |
+
function gtag(){dataLayer.push(arguments);}
|
| 57 |
+
gtag('js', new Date());
|
| 58 |
+
|
| 59 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 60 |
+
</script>
|
classes/types.PersistLogInstance.html
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistLogInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistLogInstance.html">PersistLogInstance</a></li></ul><h1>Class PersistLogInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistLogInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Each log entry stored as separate JSON file keyed by <a href="http://entry.id">entry.id</a></li>
|
| 5 |
+
<li>Read iterates all keys via PersistBase.keys()</li>
|
| 6 |
+
<li>Append-only: existing keys are skipped on write</li>
|
| 7 |
+
<li>Crash-safe via atomic writes</li>
|
| 8 |
+
</ul>
|
| 9 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistLogInstance</span><span class="hl-1">();</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeLogData</span><span class="hl-1">(</span><span class="hl-4">entries</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">all</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readLogData</span><span class="hl-1">();</span>
|
| 10 |
+
</code><button type="button">Copy</button></pre>
|
| 11 |
+
|
| 12 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistLogInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistLogInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14560">types.d.ts:14560</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistLogInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistLogInstance.html#readlogdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Log<wbr/>Data</span></a>
|
| 14 |
+
<a href="types.PersistLogInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 15 |
+
<a href="types.PersistLogInstance.html#writelogdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Log<wbr/>Data</span></a>
|
| 16 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistloginstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistLogInstance</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistLogInstance.html" class="tsd-signature-type tsd-kind-class">PersistLogInstance</a><a href="#constructorpersistloginstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new log persistence instance.
|
| 17 |
+
No context parameters — there is a single global log storage.</p>
|
| 18 |
+
</div><h4 class="tsd-returns-title">Returns <a href="types.PersistLogInstance.html" class="tsd-signature-type tsd-kind-class">PersistLogInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14567">types.d.ts:14567</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readlogdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Log<wbr/>Data</span><a href="#readlogdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readlogdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readLogData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.LogData.html" class="tsd-signature-type tsd-kind-type-alias">LogData</a><span class="tsd-signature-symbol">></span><a href="#readlogdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads all persisted log entries by iterating storage keys.</p>
|
| 19 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.LogData.html" class="tsd-signature-type tsd-kind-type-alias">LogData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to array of log entries</p>
|
| 20 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistLogInstance.html">IPersistLogInstance</a>.<a href="../interfaces/types.IPersistLogInstance.html#readlogdata">readLogData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14580">types.d.ts:14580</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 21 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 23 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistLogInstance.html">IPersistLogInstance</a>.<a href="../interfaces/types.IPersistLogInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14574">types.d.ts:14574</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writelogdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Log<wbr/>Data</span><a href="#writelogdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writelogdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeLogData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">logData</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.LogData.html" class="tsd-signature-type tsd-kind-type-alias">LogData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writelogdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes log entries append-only — skips entries whose id already exists
|
| 24 |
+
so the log file is never overwritten.</p>
|
| 25 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">logData</span>: <a href="../types/types.LogData.html" class="tsd-signature-type tsd-kind-type-alias">LogData</a></span><div class="tsd-comment tsd-typography"><p>Log entries to persist</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when all writes are complete</p>
|
| 27 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistLogInstance.html">IPersistLogInstance</a>.<a href="../interfaces/types.IPersistLogInstance.html#writelogdata">writeLogData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14588">types.d.ts:14588</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readlogdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Log<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writelogdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Log<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 28 |
+
|
| 29 |
+
<!-- Yandex.Metrika counter -->
|
| 30 |
+
<script type="text/javascript">
|
| 31 |
+
(function(m,e,t,r,i,k,a){
|
| 32 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 33 |
+
m[i].l=1*new Date();
|
| 34 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 35 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 36 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 37 |
+
|
| 38 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 39 |
+
</script>
|
| 40 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 41 |
+
<!-- /Yandex.Metrika counter -->
|
| 42 |
+
|
| 43 |
+
<!-- Google tag (gtag.js) -->
|
| 44 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 45 |
+
<script>
|
| 46 |
+
window.dataLayer = window.dataLayer || [];
|
| 47 |
+
function gtag(){dataLayer.push(arguments);}
|
| 48 |
+
gtag('js', new Date());
|
| 49 |
+
|
| 50 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 51 |
+
</script>
|
classes/types.PersistMeasureInstance.html
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistMeasureInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistMeasureInstance.html">PersistMeasureInstance</a></li></ul><h1>Class PersistMeasureInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistMeasureInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Soft delete via <code>removed: true</code> flag</li>
|
| 6 |
+
<li>listMeasureData filters out removed entries</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistMeasureInstance</span><span class="hl-1">(</span><span class="hl-2">"my-bucket"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeMeasureData</span><span class="hl-1">({ </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">"x"</span><span class="hl-1">, </span><span class="hl-4">data:</span><span class="hl-1"> {}, </span><span class="hl-4">removed:</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1"> }, </span><span class="hl-2">"key1"</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readMeasureData</span><span class="hl-1">(</span><span class="hl-2">"key1"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">removeMeasureData</span><span class="hl-1">(</span><span class="hl-2">"key1"</span><span class="hl-1">);</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistMeasureInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistMeasureInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14730">types.d.ts:14730</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistMeasureInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistMeasureInstance.html#bucket" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket</span></a>
|
| 13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistMeasureInstance.html#listmeasuredata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Measure<wbr/>Data</span></a>
|
| 14 |
+
<a href="types.PersistMeasureInstance.html#readmeasuredata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Measure<wbr/>Data</span></a>
|
| 15 |
+
<a href="types.PersistMeasureInstance.html#removemeasuredata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Measure<wbr/>Data</span></a>
|
| 16 |
+
<a href="types.PersistMeasureInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
+
<a href="types.PersistMeasureInstance.html#writemeasuredata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Measure<wbr/>Data</span></a>
|
| 18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistmeasureinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistMeasureInstance</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">bucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistMeasureInstance.html" class="tsd-signature-type tsd-kind-class">PersistMeasureInstance</a><a href="#constructorpersistmeasureinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new measure cache persistence instance.</p>
|
| 19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">bucket</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Cache bucket identifier</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistMeasureInstance.html" class="tsd-signature-type tsd-kind-class">PersistMeasureInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14739">types.d.ts:14739</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="bucket" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>bucket</span><a href="#bucket" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14731">types.d.ts:14731</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="listmeasuredata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>list<wbr/>Measure<wbr/>Data</span><a href="#listmeasuredata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="listmeasuredata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listMeasureData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><a href="#listmeasuredata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Iterates all entries in the bucket, yielding keys of non-removed entries only.</p>
|
| 21 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><p>AsyncGenerator yielding entry keys</p>
|
| 22 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMeasureInstance.html">IPersistMeasureInstance</a>.<a href="../interfaces/types.IPersistMeasureInstance.html#listmeasuredata">listMeasureData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14774">types.d.ts:14774</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="readmeasuredata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Measure<wbr/>Data</span><a href="#readmeasuredata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readmeasuredata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readMeasureData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.MeasureData.html" class="tsd-signature-type tsd-kind-type-alias">MeasureData</a><span class="tsd-signature-symbol">></span><a href="#readmeasuredata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads a measure entry by key. Returns null if entry is missing or soft-deleted.</p>
|
| 23 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Cache key within the bucket</p>
|
| 24 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.MeasureData.html" class="tsd-signature-type tsd-kind-type-alias">MeasureData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to entry data, or null</p>
|
| 25 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMeasureInstance.html">IPersistMeasureInstance</a>.<a href="../interfaces/types.IPersistMeasureInstance.html#readmeasuredata">readMeasureData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14753">types.d.ts:14753</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="removemeasuredata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Measure<wbr/>Data</span><a href="#removemeasuredata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="removemeasuredata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">removeMeasureData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#removemeasuredata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Soft-deletes an entry by writing <code>removed: true</code> flag while preserving the file.</p>
|
| 26 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Cache key within the bucket</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when removal is complete</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMeasureInstance.html">IPersistMeasureInstance</a>.<a href="../interfaces/types.IPersistMeasureInstance.html#removemeasuredata">removeMeasureData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14768">types.d.ts:14768</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 29 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 30 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 31 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMeasureInstance.html">IPersistMeasureInstance</a>.<a href="../interfaces/types.IPersistMeasureInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14746">types.d.ts:14746</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writemeasuredata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Measure<wbr/>Data</span><a href="#writemeasuredata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writemeasuredata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeMeasureData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.MeasureData.html" class="tsd-signature-type tsd-kind-type-alias">MeasureData</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">key</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writemeasuredata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes a measure entry under the given key.</p>
|
| 32 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a href="../types/types.MeasureData.html" class="tsd-signature-type tsd-kind-type-alias">MeasureData</a></span><div class="tsd-comment tsd-typography"><p>Data to cache</p>
|
| 33 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Cache key within the bucket</p>
|
| 34 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 35 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMeasureInstance.html">IPersistMeasureInstance</a>.<a href="../interfaces/types.IPersistMeasureInstance.html#writemeasuredata">writeMeasureData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14761">types.d.ts:14761</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#bucket" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#listmeasuredata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Measure<wbr/>Data</span></a><a href="#readmeasuredata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Measure<wbr/>Data</span></a><a href="#removemeasuredata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Measure<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writemeasuredata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Measure<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 36 |
+
|
| 37 |
+
<!-- Yandex.Metrika counter -->
|
| 38 |
+
<script type="text/javascript">
|
| 39 |
+
(function(m,e,t,r,i,k,a){
|
| 40 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 41 |
+
m[i].l=1*new Date();
|
| 42 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 43 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 44 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 45 |
+
|
| 46 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 47 |
+
</script>
|
| 48 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 49 |
+
<!-- /Yandex.Metrika counter -->
|
| 50 |
+
|
| 51 |
+
<!-- Google tag (gtag.js) -->
|
| 52 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 53 |
+
<script>
|
| 54 |
+
window.dataLayer = window.dataLayer || [];
|
| 55 |
+
function gtag(){dataLayer.push(arguments);}
|
| 56 |
+
gtag('js', new Date());
|
| 57 |
+
|
| 58 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 59 |
+
</script>
|
classes/types.PersistMemoryInstance.html
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistMemoryInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistMemoryInstance.html">PersistMemoryInstance</a></li></ul><h1>Class PersistMemoryInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistMemoryInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Soft delete via <code>removed: true</code> flag</li>
|
| 6 |
+
<li>listMemoryData filters out removed entries</li>
|
| 7 |
+
<li>dispose is a no-op (memo cache is managed by PersistMemoryUtils)</li>
|
| 8 |
+
</ul>
|
| 9 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistMemoryInstance</span><span class="hl-1">(</span><span class="hl-2">"signal-1"</span><span class="hl-1">, </span><span class="hl-2">"context-bucket"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeMemoryData</span><span class="hl-1">(</span><span class="hl-4">entryData</span><span class="hl-1">, </span><span class="hl-2">"memory-id-1"</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readMemoryData</span><span class="hl-1">(</span><span class="hl-2">"memory-id-1"</span><span class="hl-1">);</span>
|
| 10 |
+
</code><button type="button">Copy</button></pre>
|
| 11 |
+
|
| 12 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistMemoryInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistMemoryInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15154">types.d.ts:15154</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistMemoryInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistMemoryInstance.html#bucketname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistMemoryInstance.html#signalid" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>signal<wbr/>Id</span></a>
|
| 15 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistMemoryInstance.html#dispose" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a>
|
| 16 |
+
<a href="types.PersistMemoryInstance.html#hasmemorydata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>has<wbr/>Memory<wbr/>Data</span></a>
|
| 17 |
+
<a href="types.PersistMemoryInstance.html#listmemorydata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Memory<wbr/>Data</span></a>
|
| 18 |
+
<a href="types.PersistMemoryInstance.html#readmemorydata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Memory<wbr/>Data</span></a>
|
| 19 |
+
<a href="types.PersistMemoryInstance.html#removememorydata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Memory<wbr/>Data</span></a>
|
| 20 |
+
<a href="types.PersistMemoryInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 21 |
+
<a href="types.PersistMemoryInstance.html#writememorydata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Memory<wbr/>Data</span></a>
|
| 22 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistmemoryinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistMemoryInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistMemoryInstance.html" class="tsd-signature-type tsd-kind-class">PersistMemoryInstance</a><a href="#constructorpersistmemoryinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new memory persistence instance.</p>
|
| 23 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier (entity folder name)</p>
|
| 24 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">bucketName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Bucket name (subfolder under memory/)</p>
|
| 25 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistMemoryInstance.html" class="tsd-signature-type tsd-kind-class">PersistMemoryInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15165">types.d.ts:15165</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="bucketname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>bucket<wbr/>Name</span><a href="#bucketname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15156">types.d.ts:15156</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="signalid" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>signal<wbr/>Id</span><a href="#signalid" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15155">types.d.ts:15155</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="dispose" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose</span><a href="#dispose" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="dispose-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dispose</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#dispose-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>No-op for the default file-based implementation.
|
| 26 |
+
Resource cleanup (memo cache invalidation) is handled by PersistMemoryUtils.dispose().</p>
|
| 27 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMemoryInstance.html">IPersistMemoryInstance</a>.<a href="../interfaces/types.IPersistMemoryInstance.html#dispose">dispose</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15216">types.d.ts:15216</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="hasmemorydata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>has<wbr/>Memory<wbr/>Data</span><a href="#hasmemorydata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="hasmemorydata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">hasMemoryData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#hasmemorydata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Checks whether a memory entry exists on disk (regardless of removed flag).</p>
|
| 28 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">memoryId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Memory entry identifier</p>
|
| 29 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to true if entry file exists</p>
|
| 30 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMemoryInstance.html">IPersistMemoryInstance</a>.<a href="../interfaces/types.IPersistMemoryInstance.html#hasmemorydata">hasMemoryData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15186">types.d.ts:15186</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="listmemorydata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>list<wbr/>Memory<wbr/>Data</span><a href="#listmemorydata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="listmemorydata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">listMemoryData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.MemoryData.html" class="tsd-signature-type tsd-kind-type-alias">MemoryData</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><a href="#listmemorydata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Iterates all memory entries in the bucket, yielding id + data tuples
|
| 31 |
+
for non-removed entries only.</p>
|
| 32 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">AsyncGenerator</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.MemoryData.html" class="tsd-signature-type tsd-kind-type-alias">MemoryData</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span></h4><p>AsyncGenerator yielding <code>{ memoryId, data }</code> tuples</p>
|
| 33 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMemoryInstance.html">IPersistMemoryInstance</a>.<a href="../interfaces/types.IPersistMemoryInstance.html#listmemorydata">listMemoryData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15208">types.d.ts:15208</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="readmemorydata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Memory<wbr/>Data</span><a href="#readmemorydata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readmemorydata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readMemoryData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.MemoryData.html" class="tsd-signature-type tsd-kind-type-alias">MemoryData</a><span class="tsd-signature-symbol">></span><a href="#readmemorydata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads a memory entry by id. Returns null if entry is missing or soft-deleted.</p>
|
| 34 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">memoryId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Memory entry identifier</p>
|
| 35 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.MemoryData.html" class="tsd-signature-type tsd-kind-type-alias">MemoryData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to entry data, or null</p>
|
| 36 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMemoryInstance.html">IPersistMemoryInstance</a>.<a href="../interfaces/types.IPersistMemoryInstance.html#readmemorydata">readMemoryData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15179">types.d.ts:15179</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="removememorydata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Memory<wbr/>Data</span><a href="#removememorydata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="removememorydata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">removeMemoryData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#removememorydata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Soft-deletes a memory entry by writing <code>removed: true</code> flag.</p>
|
| 37 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">memoryId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Memory entry identifier</p>
|
| 38 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when removal is complete</p>
|
| 39 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMemoryInstance.html">IPersistMemoryInstance</a>.<a href="../interfaces/types.IPersistMemoryInstance.html#removememorydata">removeMemoryData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15201">types.d.ts:15201</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 40 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 41 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 42 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMemoryInstance.html">IPersistMemoryInstance</a>.<a href="../interfaces/types.IPersistMemoryInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15172">types.d.ts:15172</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writememorydata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Memory<wbr/>Data</span><a href="#writememorydata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writememorydata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeMemoryData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.MemoryData.html" class="tsd-signature-type tsd-kind-type-alias">MemoryData</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">memoryId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writememorydata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes a memory entry under the given id.</p>
|
| 43 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a href="../types/types.MemoryData.html" class="tsd-signature-type tsd-kind-type-alias">MemoryData</a></span><div class="tsd-comment tsd-typography"><p>Entry data to persist</p>
|
| 44 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">memoryId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Memory entry identifier</p>
|
| 45 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 46 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistMemoryInstance.html">IPersistMemoryInstance</a>.<a href="../interfaces/types.IPersistMemoryInstance.html#writememorydata">writeMemoryData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15194">types.d.ts:15194</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#bucketname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket<wbr/>Name</span></a><a href="#signalid" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>signal<wbr/>Id</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#dispose" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a><a href="#hasmemorydata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>has<wbr/>Memory<wbr/>Data</span></a><a href="#listmemorydata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>list<wbr/>Memory<wbr/>Data</span></a><a href="#readmemorydata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Memory<wbr/>Data</span></a><a href="#removememorydata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Memory<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writememorydata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Memory<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 47 |
+
|
| 48 |
+
<!-- Yandex.Metrika counter -->
|
| 49 |
+
<script type="text/javascript">
|
| 50 |
+
(function(m,e,t,r,i,k,a){
|
| 51 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 52 |
+
m[i].l=1*new Date();
|
| 53 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 54 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 55 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 56 |
+
|
| 57 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 58 |
+
</script>
|
| 59 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 60 |
+
<!-- /Yandex.Metrika counter -->
|
| 61 |
+
|
| 62 |
+
<!-- Google tag (gtag.js) -->
|
| 63 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 64 |
+
<script>
|
| 65 |
+
window.dataLayer = window.dataLayer || [];
|
| 66 |
+
function gtag(){dataLayer.push(arguments);}
|
| 67 |
+
gtag('js', new Date());
|
| 68 |
+
|
| 69 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 70 |
+
</script>
|
classes/types.PersistNotificationInstance.html
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistNotificationInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistNotificationInstance.html">PersistNotificationInstance</a></li></ul><h1>Class PersistNotificationInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistNotificationInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Each notification stored as separate JSON file keyed by id</li>
|
| 5 |
+
<li>Read iterates all keys via PersistBase.keys()</li>
|
| 6 |
+
<li>Crash-safe via atomic writes</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistNotificationInstance</span><span class="hl-1">(</span><span class="hl-3">false</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeNotificationData</span><span class="hl-1">(</span><span class="hl-4">notifications</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">all</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readNotificationData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistNotificationInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistNotificationInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14399">types.d.ts:14399</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistNotificationInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistNotificationInstance.html#backtest" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>backtest</span></a>
|
| 13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistNotificationInstance.html#readnotificationdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Notification<wbr/>Data</span></a>
|
| 14 |
+
<a href="types.PersistNotificationInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 15 |
+
<a href="types.PersistNotificationInstance.html#writenotificationdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Notification<wbr/>Data</span></a>
|
| 16 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistnotificationinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistNotificationInstance</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">backtest</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistNotificationInstance.html" class="tsd-signature-type tsd-kind-class">PersistNotificationInstance</a><a href="#constructorpersistnotificationinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new notification persistence instance.</p>
|
| 17 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>True for backtest mode storage, false for live mode</p>
|
| 18 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistNotificationInstance.html" class="tsd-signature-type tsd-kind-class">PersistNotificationInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14408">types.d.ts:14408</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="backtest" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>backtest</span><a href="#backtest" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">backtest</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14400">types.d.ts:14400</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readnotificationdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Notification<wbr/>Data</span><a href="#readnotificationdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readnotificationdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readNotificationData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.NotificationData.html" class="tsd-signature-type tsd-kind-type-alias">NotificationData</a><span class="tsd-signature-symbol">></span><a href="#readnotificationdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads all persisted notifications by iterating storage keys.</p>
|
| 19 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.NotificationData.html" class="tsd-signature-type tsd-kind-type-alias">NotificationData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to array of notification entries</p>
|
| 20 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistNotificationInstance.html">IPersistNotificationInstance</a>.<a href="../interfaces/types.IPersistNotificationInstance.html#readnotificationdata">readNotificationData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14421">types.d.ts:14421</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 21 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 23 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistNotificationInstance.html">IPersistNotificationInstance</a>.<a href="../interfaces/types.IPersistNotificationInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14415">types.d.ts:14415</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writenotificationdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Notification<wbr/>Data</span><a href="#writenotificationdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writenotificationdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeNotificationData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">notifications</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.NotificationData.html" class="tsd-signature-type tsd-kind-type-alias">NotificationData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writenotificationdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes each notification as a separate entity keyed by <code>notification.id</code>.</p>
|
| 24 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">notifications</span>: <a href="../types/types.NotificationData.html" class="tsd-signature-type tsd-kind-type-alias">NotificationData</a></span><div class="tsd-comment tsd-typography"><p>Notification entries to persist</p>
|
| 25 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when all writes are complete</p>
|
| 26 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistNotificationInstance.html">IPersistNotificationInstance</a>.<a href="../interfaces/types.IPersistNotificationInstance.html#writenotificationdata">writeNotificationData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14428">types.d.ts:14428</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#backtest" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>backtest</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readnotificationdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Notification<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writenotificationdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Notification<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 27 |
+
|
| 28 |
+
<!-- Yandex.Metrika counter -->
|
| 29 |
+
<script type="text/javascript">
|
| 30 |
+
(function(m,e,t,r,i,k,a){
|
| 31 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 32 |
+
m[i].l=1*new Date();
|
| 33 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 34 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 35 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 36 |
+
|
| 37 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 38 |
+
</script>
|
| 39 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 40 |
+
<!-- /Yandex.Metrika counter -->
|
| 41 |
+
|
| 42 |
+
<!-- Google tag (gtag.js) -->
|
| 43 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 44 |
+
<script>
|
| 45 |
+
window.dataLayer = window.dataLayer || [];
|
| 46 |
+
function gtag(){dataLayer.push(arguments);}
|
| 47 |
+
gtag('js', new Date());
|
| 48 |
+
|
| 49 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 50 |
+
</script>
|
classes/types.PersistPartialInstance.html
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistPartialInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistPartialInstance.html">PersistPartialInstance</a></li></ul><h1>Class PersistPartialInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistPartialInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses signalId as entity ID within a per-context PersistBase</li>
|
| 6 |
+
<li>Crash-safe via atomic writes</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistPartialInstance</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writePartialData</span><span class="hl-1">(</span><span class="hl-4">partialData</span><span class="hl-1">, </span><span class="hl-2">"signal-id-1"</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">restored</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readPartialData</span><span class="hl-1">(</span><span class="hl-2">"signal-id-1"</span><span class="hl-1">);</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistPartialInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistPartialInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13667">types.d.ts:13667</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistPartialInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistPartialInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 13 |
+
<a href="types.PersistPartialInstance.html#strategyname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistPartialInstance.html#symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a>
|
| 15 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistPartialInstance.html#readpartialdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Partial<wbr/>Data</span></a>
|
| 16 |
+
<a href="types.PersistPartialInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
+
<a href="types.PersistPartialInstance.html#writepartialdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Partial<wbr/>Data</span></a>
|
| 18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistpartialinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistPartialInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistPartialInstance.html" class="tsd-signature-type tsd-kind-class">PersistPartialInstance</a><a href="#constructorpersistpartialinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new partial data persistence instance.</p>
|
| 19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">strategyName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Strategy identifier</p>
|
| 21 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistPartialInstance.html" class="tsd-signature-type tsd-kind-class">PersistPartialInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13680">types.d.ts:13680</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13670">types.d.ts:13670</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="strategyname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>strategy<wbr/>Name</span><a href="#strategyname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13669">types.d.ts:13669</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>symbol</span><a href="#symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13668">types.d.ts:13668</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readpartialdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Partial<wbr/>Data</span><a href="#readpartialdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readpartialdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readPartialData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.PartialData.html" class="tsd-signature-type tsd-kind-type-alias">PartialData</a><span class="tsd-signature-symbol">></span><a href="#readpartialdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the partial data for the given signal using <code>signalId</code> as the entity key.</p>
|
| 23 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 24 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.PartialData.html" class="tsd-signature-type tsd-kind-type-alias">PartialData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to partial data record (empty object if not found)</p>
|
| 25 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistPartialInstance.html">IPersistPartialInstance</a>.<a href="../interfaces/types.IPersistPartialInstance.html#readpartialdata">readPartialData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13694">types.d.ts:13694</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 26 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistPartialInstance.html">IPersistPartialInstance</a>.<a href="../interfaces/types.IPersistPartialInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13687">types.d.ts:13687</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writepartialdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Partial<wbr/>Data</span><a href="#writepartialdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writepartialdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writePartialData</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.PartialData.html" class="tsd-signature-type tsd-kind-type-alias">PartialData</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writepartialdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the partial data for the given signal using <code>signalId</code> as the entity key.</p>
|
| 29 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a href="../types/types.PartialData.html" class="tsd-signature-type tsd-kind-type-alias">PartialData</a></span><div class="tsd-comment tsd-typography"><p>Partial data record to persist</p>
|
| 30 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 31 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 32 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistPartialInstance.html">IPersistPartialInstance</a>.<a href="../interfaces/types.IPersistPartialInstance.html#writepartialdata">writePartialData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13703">types.d.ts:13703</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#strategyname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a><a href="#symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readpartialdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Partial<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writepartialdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Partial<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 33 |
+
|
| 34 |
+
<!-- Yandex.Metrika counter -->
|
| 35 |
+
<script type="text/javascript">
|
| 36 |
+
(function(m,e,t,r,i,k,a){
|
| 37 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 38 |
+
m[i].l=1*new Date();
|
| 39 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 40 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 41 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 42 |
+
|
| 43 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 44 |
+
</script>
|
| 45 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 46 |
+
<!-- /Yandex.Metrika counter -->
|
| 47 |
+
|
| 48 |
+
<!-- Google tag (gtag.js) -->
|
| 49 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 50 |
+
<script>
|
| 51 |
+
window.dataLayer = window.dataLayer || [];
|
| 52 |
+
function gtag(){dataLayer.push(arguments);}
|
| 53 |
+
gtag('js', new Date());
|
| 54 |
+
|
| 55 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 56 |
+
</script>
|
classes/types.PersistRecentInstance.html
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistRecentInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistRecentInstance.html">PersistRecentInstance</a></li></ul><h1>Class PersistRecentInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistRecentInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses symbol as entity ID within a per-context PersistBase</li>
|
| 6 |
+
<li>Context key includes backtest/live mode and optional frameName</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistRecentInstance</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">, </span><span class="hl-2">"frame-1"</span><span class="hl-1">, </span><span class="hl-3">false</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeRecentData</span><span class="hl-1">(</span><span class="hl-4">publicSignalRow</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">recent</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readRecentData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistRecentInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistRecentInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15409">types.d.ts:15409</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistRecentInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistRecentInstance.html#backtest" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>backtest</span></a>
|
| 13 |
+
<a href="types.PersistRecentInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistRecentInstance.html#framename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>frame<wbr/>Name</span></a>
|
| 15 |
+
<a href="types.PersistRecentInstance.html#strategyname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a>
|
| 16 |
+
<a href="types.PersistRecentInstance.html#symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a>
|
| 17 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistRecentInstance.html#readrecentdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Recent<wbr/>Data</span></a>
|
| 18 |
+
<a href="types.PersistRecentInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 19 |
+
<a href="types.PersistRecentInstance.html#writerecentdata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Recent<wbr/>Data</span></a>
|
| 20 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistrecentinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistRecentInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">backtest</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistRecentInstance.html" class="tsd-signature-type tsd-kind-class">PersistRecentInstance</a><a href="#constructorpersistrecentinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new recent signal persistence instance.</p>
|
| 21 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">strategyName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Strategy identifier</p>
|
| 23 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 24 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">frameName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Frame identifier (may be empty for live mode)</p>
|
| 25 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>True for backtest mode, false for live mode</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistRecentInstance.html" class="tsd-signature-type tsd-kind-class">PersistRecentInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15426">types.d.ts:15426</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="backtest" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>backtest</span><a href="#backtest" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">backtest</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15414">types.d.ts:15414</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15412">types.d.ts:15412</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="framename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>frame<wbr/>Name</span><a href="#framename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15413">types.d.ts:15413</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="strategyname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>strategy<wbr/>Name</span><a href="#strategyname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15411">types.d.ts:15411</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>symbol</span><a href="#symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15410">types.d.ts:15410</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readrecentdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Recent<wbr/>Data</span><a href="#readrecentdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readrecentdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readRecentData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.IPublicSignalRow.html" class="tsd-signature-type tsd-kind-interface">IPublicSignalRow</a><span class="tsd-signature-symbol">></span><a href="#readrecentdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the persisted recent signal using <code>symbol</code> as the entity key.</p>
|
| 27 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.IPublicSignalRow.html" class="tsd-signature-type tsd-kind-interface">IPublicSignalRow</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to recent signal or null if not found</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistRecentInstance.html">IPersistRecentInstance</a>.<a href="../interfaces/types.IPersistRecentInstance.html#readrecentdata">readRecentData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15439">types.d.ts:15439</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 29 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 30 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 31 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistRecentInstance.html">IPersistRecentInstance</a>.<a href="../interfaces/types.IPersistRecentInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15433">types.d.ts:15433</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writerecentdata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Recent<wbr/>Data</span><a href="#writerecentdata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writerecentdata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeRecentData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalRow</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.IPublicSignalRow.html" class="tsd-signature-type tsd-kind-interface">IPublicSignalRow</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writerecentdata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the recent signal using <code>symbol</code> as the entity key.</p>
|
| 32 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalRow</span>: <a href="../interfaces/types.IPublicSignalRow.html" class="tsd-signature-type tsd-kind-interface">IPublicSignalRow</a></span><div class="tsd-comment tsd-typography"><p>Recent signal data to persist</p>
|
| 33 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 34 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistRecentInstance.html">IPersistRecentInstance</a>.<a href="../interfaces/types.IPersistRecentInstance.html#writerecentdata">writeRecentData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15446">types.d.ts:15446</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#backtest" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>backtest</span></a><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#framename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>frame<wbr/>Name</span></a><a href="#strategyname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a><a href="#symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readrecentdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Recent<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writerecentdata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Recent<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 35 |
+
|
| 36 |
+
<!-- Yandex.Metrika counter -->
|
| 37 |
+
<script type="text/javascript">
|
| 38 |
+
(function(m,e,t,r,i,k,a){
|
| 39 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 40 |
+
m[i].l=1*new Date();
|
| 41 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 42 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 43 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 44 |
+
|
| 45 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 46 |
+
</script>
|
| 47 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 48 |
+
<!-- /Yandex.Metrika counter -->
|
| 49 |
+
|
| 50 |
+
<!-- Google tag (gtag.js) -->
|
| 51 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 52 |
+
<script>
|
| 53 |
+
window.dataLayer = window.dataLayer || [];
|
| 54 |
+
function gtag(){dataLayer.push(arguments);}
|
| 55 |
+
gtag('js', new Date());
|
| 56 |
+
|
| 57 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 58 |
+
</script>
|
classes/types.PersistRiskInstance.html
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistRiskInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistRiskInstance.html">PersistRiskInstance</a></li></ul><h1>Class PersistRiskInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistRiskInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses fixed entity ID "positions" within a per-context PersistBase</li>
|
| 6 |
+
<li>Crash-safe via atomic writes</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistRiskInstance</span><span class="hl-1">(</span><span class="hl-2">"my-risk"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writePositionData</span><span class="hl-1">([[</span><span class="hl-2">"strategy:BTCUSDT"</span><span class="hl-1">, </span><span class="hl-4">positionData</span><span class="hl-1">]]);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">positions</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readPositionData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistRiskInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistRiskInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13319">types.d.ts:13319</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistRiskInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistRiskInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 13 |
+
<a href="types.PersistRiskInstance.html#riskname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>risk<wbr/>Name</span></a>
|
| 14 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistRiskInstance.html#readpositiondata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Position<wbr/>Data</span></a>
|
| 15 |
+
<a href="types.PersistRiskInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 16 |
+
<a href="types.PersistRiskInstance.html#writepositiondata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Position<wbr/>Data</span></a>
|
| 17 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistriskinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistRiskInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">riskName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistRiskInstance.html" class="tsd-signature-type tsd-kind-class">PersistRiskInstance</a><a href="#constructorpersistriskinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new risk positions persistence instance.</p>
|
| 18 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">riskName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Risk profile identifier</p>
|
| 19 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistRiskInstance.html" class="tsd-signature-type tsd-kind-class">PersistRiskInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13332">types.d.ts:13332</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13321">types.d.ts:13321</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="riskname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>risk<wbr/>Name</span><a href="#riskname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">riskName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13320">types.d.ts:13320</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readpositiondata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Position<wbr/>Data</span><a href="#readpositiondata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readpositiondata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readPositionData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.RiskData.html" class="tsd-signature-type tsd-kind-type-alias">RiskData</a><span class="tsd-signature-symbol">></span><a href="#readpositiondata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the persisted positions array using the fixed STORAGE_KEY.</p>
|
| 21 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.RiskData.html" class="tsd-signature-type tsd-kind-type-alias">RiskData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to positions (empty array if none persisted)</p>
|
| 22 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistRiskInstance.html">IPersistRiskInstance</a>.<a href="../interfaces/types.IPersistRiskInstance.html#readpositiondata">readPositionData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13345">types.d.ts:13345</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 23 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 24 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 25 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistRiskInstance.html">IPersistRiskInstance</a>.<a href="../interfaces/types.IPersistRiskInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13339">types.d.ts:13339</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writepositiondata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Position<wbr/>Data</span><a href="#writepositiondata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writepositiondata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writePositionData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">riskRow</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.RiskData.html" class="tsd-signature-type tsd-kind-type-alias">RiskData</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writepositiondata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the positions array using the fixed STORAGE_KEY.</p>
|
| 26 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">riskRow</span>: <a href="../types/types.RiskData.html" class="tsd-signature-type tsd-kind-type-alias">RiskData</a></span><div class="tsd-comment tsd-typography"><p>Position entries to persist</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistRiskInstance.html">IPersistRiskInstance</a>.<a href="../interfaces/types.IPersistRiskInstance.html#writepositiondata">writePositionData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13353">types.d.ts:13353</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#riskname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>risk<wbr/>Name</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readpositiondata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Position<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writepositiondata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Position<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 29 |
+
|
| 30 |
+
<!-- Yandex.Metrika counter -->
|
| 31 |
+
<script type="text/javascript">
|
| 32 |
+
(function(m,e,t,r,i,k,a){
|
| 33 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 34 |
+
m[i].l=1*new Date();
|
| 35 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 36 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 37 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 38 |
+
|
| 39 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 40 |
+
</script>
|
| 41 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 42 |
+
<!-- /Yandex.Metrika counter -->
|
| 43 |
+
|
| 44 |
+
<!-- Google tag (gtag.js) -->
|
| 45 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 46 |
+
<script>
|
| 47 |
+
window.dataLayer = window.dataLayer || [];
|
| 48 |
+
function gtag(){dataLayer.push(arguments);}
|
| 49 |
+
gtag('js', new Date());
|
| 50 |
+
|
| 51 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 52 |
+
</script>
|
classes/types.PersistScheduleInstance.html
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistScheduleInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistScheduleInstance.html">PersistScheduleInstance</a></li></ul><h1>Class PersistScheduleInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistScheduleInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses symbol as entity ID within a per-context PersistBase</li>
|
| 6 |
+
<li>Crash-safe via atomic writes</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistScheduleInstance</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeScheduleData</span><span class="hl-1">(</span><span class="hl-4">scheduledRow</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">restored</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readScheduleData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistScheduleInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistScheduleInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13490">types.d.ts:13490</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistScheduleInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistScheduleInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 13 |
+
<a href="types.PersistScheduleInstance.html#strategyname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistScheduleInstance.html#symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a>
|
| 15 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistScheduleInstance.html#readscheduledata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Schedule<wbr/>Data</span></a>
|
| 16 |
+
<a href="types.PersistScheduleInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
+
<a href="types.PersistScheduleInstance.html#writescheduledata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Schedule<wbr/>Data</span></a>
|
| 18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistscheduleinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistScheduleInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistScheduleInstance.html" class="tsd-signature-type tsd-kind-class">PersistScheduleInstance</a><a href="#constructorpersistscheduleinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new scheduled signal persistence instance.</p>
|
| 19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">strategyName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Strategy identifier</p>
|
| 21 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistScheduleInstance.html" class="tsd-signature-type tsd-kind-class">PersistScheduleInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13503">types.d.ts:13503</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13493">types.d.ts:13493</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="strategyname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>strategy<wbr/>Name</span><a href="#strategyname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13492">types.d.ts:13492</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>symbol</span><a href="#symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13491">types.d.ts:13491</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readscheduledata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Schedule<wbr/>Data</span><a href="#readscheduledata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readscheduledata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readScheduleData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.IScheduledSignalRow.html" class="tsd-signature-type tsd-kind-interface">IScheduledSignalRow</a><span class="tsd-signature-symbol">></span><a href="#readscheduledata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the persisted scheduled signal using <code>symbol</code> as the entity key.</p>
|
| 23 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.IScheduledSignalRow.html" class="tsd-signature-type tsd-kind-interface">IScheduledSignalRow</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to scheduled signal or null if not found</p>
|
| 24 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistScheduleInstance.html">IPersistScheduleInstance</a>.<a href="../interfaces/types.IPersistScheduleInstance.html#readscheduledata">readScheduleData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13516">types.d.ts:13516</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 25 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 27 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistScheduleInstance.html">IPersistScheduleInstance</a>.<a href="../interfaces/types.IPersistScheduleInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13510">types.d.ts:13510</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writescheduledata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Schedule<wbr/>Data</span><a href="#writescheduledata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writescheduledata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeScheduleData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">row</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.IScheduledSignalRow.html" class="tsd-signature-type tsd-kind-interface">IScheduledSignalRow</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writescheduledata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the scheduled signal (or null to clear) using <code>symbol</code> as the entity key.</p>
|
| 28 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">row</span>: <a href="../interfaces/types.IScheduledSignalRow.html" class="tsd-signature-type tsd-kind-interface">IScheduledSignalRow</a></span><div class="tsd-comment tsd-typography"><p>Scheduled signal data to persist, or null to clear</p>
|
| 29 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 30 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistScheduleInstance.html">IPersistScheduleInstance</a>.<a href="../interfaces/types.IPersistScheduleInstance.html#writescheduledata">writeScheduleData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13523">types.d.ts:13523</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#strategyname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a><a href="#symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readscheduledata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Schedule<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writescheduledata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Schedule<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 31 |
+
|
| 32 |
+
<!-- Yandex.Metrika counter -->
|
| 33 |
+
<script type="text/javascript">
|
| 34 |
+
(function(m,e,t,r,i,k,a){
|
| 35 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 36 |
+
m[i].l=1*new Date();
|
| 37 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 38 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 39 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 40 |
+
|
| 41 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 42 |
+
</script>
|
| 43 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 44 |
+
<!-- /Yandex.Metrika counter -->
|
| 45 |
+
|
| 46 |
+
<!-- Google tag (gtag.js) -->
|
| 47 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 48 |
+
<script>
|
| 49 |
+
window.dataLayer = window.dataLayer || [];
|
| 50 |
+
function gtag(){dataLayer.push(arguments);}
|
| 51 |
+
gtag('js', new Date());
|
| 52 |
+
|
| 53 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 54 |
+
</script>
|
classes/types.PersistSessionInstance.html
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistSessionInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistSessionInstance.html">PersistSessionInstance</a></li></ul><h1>Class PersistSessionInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistSessionInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses frameName as entity ID within a per-strategy/exchange PersistBase</li>
|
| 6 |
+
<li>dispose is a no-op (memo cache is managed by PersistSessionUtils)</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistSessionInstance</span><span class="hl-1">(</span><span class="hl-2">"my-strategy"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">, </span><span class="hl-2">"frame-1"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeSessionData</span><span class="hl-1">({ </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">"frame-1"</span><span class="hl-1">, </span><span class="hl-4">data:</span><span class="hl-1"> { </span><span class="hl-4">session:</span><span class="hl-1"> </span><span class="hl-2">"state"</span><span class="hl-1"> } });</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">session</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readSessionData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistSessionInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistSessionInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15789">types.d.ts:15789</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistSessionInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistSessionInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 13 |
+
<a href="types.PersistSessionInstance.html#framename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>frame<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistSessionInstance.html#strategyname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a>
|
| 15 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistSessionInstance.html#dispose" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a>
|
| 16 |
+
<a href="types.PersistSessionInstance.html#readsessiondata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Session<wbr/>Data</span></a>
|
| 17 |
+
<a href="types.PersistSessionInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 18 |
+
<a href="types.PersistSessionInstance.html#writesessiondata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Session<wbr/>Data</span></a>
|
| 19 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistsessioninstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistSessionInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistSessionInstance.html" class="tsd-signature-type tsd-kind-class">PersistSessionInstance</a><a href="#constructorpersistsessioninstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new session persistence instance.</p>
|
| 20 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">strategyName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Strategy identifier</p>
|
| 21 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">frameName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Frame identifier (also used as entity ID)</p>
|
| 23 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistSessionInstance.html" class="tsd-signature-type tsd-kind-class">PersistSessionInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15802">types.d.ts:15802</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15791">types.d.ts:15791</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="framename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>frame<wbr/>Name</span><a href="#framename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">frameName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15792">types.d.ts:15792</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="strategyname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>strategy<wbr/>Name</span><a href="#strategyname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15790">types.d.ts:15790</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="dispose" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose</span><a href="#dispose" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="dispose-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dispose</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#dispose-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>No-op for the default file-based implementation.
|
| 24 |
+
Resource cleanup (memo cache invalidation) is handled by PersistSessionUtils.dispose().</p>
|
| 25 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistSessionInstance.html">IPersistSessionInstance</a>.<a href="../interfaces/types.IPersistSessionInstance.html#dispose">dispose</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15827">types.d.ts:15827</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="readsessiondata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Session<wbr/>Data</span><a href="#readsessiondata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readsessiondata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readSessionData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.SessionData.html" class="tsd-signature-type tsd-kind-type-alias">SessionData</a><span class="tsd-signature-symbol">></span><a href="#readsessiondata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the persisted session data using <code>frameName</code> as the entity key.</p>
|
| 26 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.SessionData.html" class="tsd-signature-type tsd-kind-type-alias">SessionData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to session data or null if not found</p>
|
| 27 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistSessionInstance.html">IPersistSessionInstance</a>.<a href="../interfaces/types.IPersistSessionInstance.html#readsessiondata">readSessionData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15815">types.d.ts:15815</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 28 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 29 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 30 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistSessionInstance.html">IPersistSessionInstance</a>.<a href="../interfaces/types.IPersistSessionInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15809">types.d.ts:15809</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writesessiondata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Session<wbr/>Data</span><a href="#writesessiondata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writesessiondata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeSessionData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.SessionData.html" class="tsd-signature-type tsd-kind-type-alias">SessionData</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writesessiondata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the session data using <code>frameName</code> as the entity key.</p>
|
| 31 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a href="../types/types.SessionData.html" class="tsd-signature-type tsd-kind-type-alias">SessionData</a></span><div class="tsd-comment tsd-typography"><p>Session data to persist</p>
|
| 32 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 33 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistSessionInstance.html">IPersistSessionInstance</a>.<a href="../interfaces/types.IPersistSessionInstance.html#writesessiondata">writeSessionData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15822">types.d.ts:15822</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#framename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>frame<wbr/>Name</span></a><a href="#strategyname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#dispose" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a><a href="#readsessiondata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Session<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writesessiondata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Session<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 34 |
+
|
| 35 |
+
<!-- Yandex.Metrika counter -->
|
| 36 |
+
<script type="text/javascript">
|
| 37 |
+
(function(m,e,t,r,i,k,a){
|
| 38 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 39 |
+
m[i].l=1*new Date();
|
| 40 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 41 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 42 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 43 |
+
|
| 44 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 45 |
+
</script>
|
| 46 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 47 |
+
<!-- /Yandex.Metrika counter -->
|
| 48 |
+
|
| 49 |
+
<!-- Google tag (gtag.js) -->
|
| 50 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 51 |
+
<script>
|
| 52 |
+
window.dataLayer = window.dataLayer || [];
|
| 53 |
+
function gtag(){dataLayer.push(arguments);}
|
| 54 |
+
gtag('js', new Date());
|
| 55 |
+
|
| 56 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 57 |
+
</script>
|
classes/types.PersistSignalInstance.html
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistSignalInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistSignalInstance.html">PersistSignalInstance</a></li></ul><h1>Class PersistSignalInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistSignalInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses symbol as entity ID within a per-context PersistBase</li>
|
| 6 |
+
<li>Crash-safe via atomic writes</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistSignalInstance</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"my-strategy"</span><span class="hl-1">, </span><span class="hl-2">"binance"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeSignalData</span><span class="hl-1">(</span><span class="hl-4">signalRow</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">restored</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readSignalData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistSignalInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistSignalInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13146">types.d.ts:13146</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistSignalInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistSignalInstance.html#exchangename" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a>
|
| 13 |
+
<a href="types.PersistSignalInstance.html#strategyname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a>
|
| 14 |
+
<a href="types.PersistSignalInstance.html#symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a>
|
| 15 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistSignalInstance.html#readsignaldata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Signal<wbr/>Data</span></a>
|
| 16 |
+
<a href="types.PersistSignalInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
+
<a href="types.PersistSignalInstance.html#writesignaldata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Signal<wbr/>Data</span></a>
|
| 18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersistsignalinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistSignalInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistSignalInstance.html" class="tsd-signature-type tsd-kind-class">PersistSignalInstance</a><a href="#constructorpersistsignalinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new signal persistence instance.</p>
|
| 19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">symbol</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Trading pair symbol</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">strategyName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Strategy identifier</p>
|
| 21 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">exchangeName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Exchange identifier</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistSignalInstance.html" class="tsd-signature-type tsd-kind-class">PersistSignalInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13159">types.d.ts:13159</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="exchangename" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>exchange<wbr/>Name</span><a href="#exchangename" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">exchangeName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13149">types.d.ts:13149</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="strategyname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>strategy<wbr/>Name</span><a href="#strategyname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">strategyName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13148">types.d.ts:13148</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>symbol</span><a href="#symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">symbol</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13147">types.d.ts:13147</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readsignaldata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Signal<wbr/>Data</span><a href="#readsignaldata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readsignaldata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readSignalData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.ISignalRow.html" class="tsd-signature-type tsd-kind-interface">ISignalRow</a><span class="tsd-signature-symbol">></span><a href="#readsignaldata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the persisted signal using <code>symbol</code> as the entity key.</p>
|
| 23 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/types.ISignalRow.html" class="tsd-signature-type tsd-kind-interface">ISignalRow</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to the signal or null if not found</p>
|
| 24 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistSignalInstance.html">IPersistSignalInstance</a>.<a href="../interfaces/types.IPersistSignalInstance.html#readsignaldata">readSignalData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13173">types.d.ts:13173</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.
|
| 25 |
+
Delegates to PersistBase.waitForInit which uses singleshot.</p>
|
| 26 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistSignalInstance.html">IPersistSignalInstance</a>.<a href="../interfaces/types.IPersistSignalInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13167">types.d.ts:13167</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writesignaldata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Signal<wbr/>Data</span><a href="#writesignaldata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writesignaldata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeSignalData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalRow</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.ISignalRow.html" class="tsd-signature-type tsd-kind-interface">ISignalRow</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writesignaldata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the signal (or null to clear) using <code>symbol</code> as the entity key.</p>
|
| 29 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalRow</span>: <a href="../interfaces/types.ISignalRow.html" class="tsd-signature-type tsd-kind-interface">ISignalRow</a></span><div class="tsd-comment tsd-typography"><p>Signal data to persist, or null to clear</p>
|
| 30 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 31 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistSignalInstance.html">IPersistSignalInstance</a>.<a href="../interfaces/types.IPersistSignalInstance.html#writesignaldata">writeSignalData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L13180">types.d.ts:13180</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#exchangename" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>exchange<wbr/>Name</span></a><a href="#strategyname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>strategy<wbr/>Name</span></a><a href="#symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>symbol</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readsignaldata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Signal<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writesignaldata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Signal<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 32 |
+
|
| 33 |
+
<!-- Yandex.Metrika counter -->
|
| 34 |
+
<script type="text/javascript">
|
| 35 |
+
(function(m,e,t,r,i,k,a){
|
| 36 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 37 |
+
m[i].l=1*new Date();
|
| 38 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 39 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 40 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 41 |
+
|
| 42 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 43 |
+
</script>
|
| 44 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 45 |
+
<!-- /Yandex.Metrika counter -->
|
| 46 |
+
|
| 47 |
+
<!-- Google tag (gtag.js) -->
|
| 48 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 49 |
+
<script>
|
| 50 |
+
window.dataLayer = window.dataLayer || [];
|
| 51 |
+
function gtag(){dataLayer.push(arguments);}
|
| 52 |
+
gtag('js', new Date());
|
| 53 |
+
|
| 54 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 55 |
+
</script>
|
classes/types.PersistStateInstance.html
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistStateInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistStateInstance.html">PersistStateInstance</a></li></ul><h1>Class PersistStateInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistStateInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Wraps PersistBase for atomic JSON writes</li>
|
| 5 |
+
<li>Uses bucketName as entity ID within a per-signal PersistBase</li>
|
| 6 |
+
<li>dispose is a no-op (memo cache is managed by PersistStateUtils)</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistStateInstance</span><span class="hl-1">(</span><span class="hl-2">"signal-1"</span><span class="hl-1">, </span><span class="hl-2">"counter"</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeStateData</span><span class="hl-1">({ </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">"counter"</span><span class="hl-1">, </span><span class="hl-4">data:</span><span class="hl-1"> { </span><span class="hl-4">count:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1"> } });</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">state</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readStateData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistStateInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistStateInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15599">types.d.ts:15599</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistStateInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistStateInstance.html#bucketname" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket<wbr/>Name</span></a>
|
| 13 |
+
<a href="types.PersistStateInstance.html#signalid" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>signal<wbr/>Id</span></a>
|
| 14 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistStateInstance.html#dispose" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a>
|
| 15 |
+
<a href="types.PersistStateInstance.html#readstatedata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>State<wbr/>Data</span></a>
|
| 16 |
+
<a href="types.PersistStateInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 17 |
+
<a href="types.PersistStateInstance.html#writestatedata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>State<wbr/>Data</span></a>
|
| 18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersiststateinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistStateInstance</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistStateInstance.html" class="tsd-signature-type tsd-kind-class">PersistStateInstance</a><a href="#constructorpersiststateinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new state persistence instance.</p>
|
| 19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier (folder name under state/)</p>
|
| 20 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">bucketName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Bucket name (file name)</p>
|
| 21 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistStateInstance.html" class="tsd-signature-type tsd-kind-class">PersistStateInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15610">types.d.ts:15610</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="bucketname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>bucket<wbr/>Name</span><a href="#bucketname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15601">types.d.ts:15601</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="signalid" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>signal<wbr/>Id</span><a href="#signalid" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15600">types.d.ts:15600</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="dispose" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose</span><a href="#dispose" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="dispose-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dispose</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#dispose-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>No-op for the default file-based implementation.
|
| 22 |
+
Resource cleanup (memo cache invalidation) is handled by PersistStateUtils.dispose().</p>
|
| 23 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistStateInstance.html">IPersistStateInstance</a>.<a href="../interfaces/types.IPersistStateInstance.html#dispose">dispose</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15635">types.d.ts:15635</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="readstatedata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>State<wbr/>Data</span><a href="#readstatedata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readstatedata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readStateData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.StateData.html" class="tsd-signature-type tsd-kind-type-alias">StateData</a><span class="tsd-signature-symbol">></span><a href="#readstatedata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads the persisted state using <code>bucketName</code> as the entity key.</p>
|
| 24 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.StateData.html" class="tsd-signature-type tsd-kind-type-alias">StateData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to state data or null if not found</p>
|
| 25 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistStateInstance.html">IPersistStateInstance</a>.<a href="../interfaces/types.IPersistStateInstance.html#readstatedata">readStateData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15623">types.d.ts:15623</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 26 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistStateInstance.html">IPersistStateInstance</a>.<a href="../interfaces/types.IPersistStateInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15617">types.d.ts:15617</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writestatedata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>State<wbr/>Data</span><a href="#writestatedata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writestatedata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeStateData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.StateData.html" class="tsd-signature-type tsd-kind-type-alias">StateData</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">_when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writestatedata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes the state using <code>bucketName</code> as the entity key.</p>
|
| 29 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a href="../types/types.StateData.html" class="tsd-signature-type tsd-kind-type-alias">StateData</a></span><div class="tsd-comment tsd-typography"><p>State data to persist</p>
|
| 30 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">_when</span>: <span class="tsd-signature-type">Date</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when write is complete</p>
|
| 31 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistStateInstance.html">IPersistStateInstance</a>.<a href="../interfaces/types.IPersistStateInstance.html#writestatedata">writeStateData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L15630">types.d.ts:15630</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#bucketname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bucket<wbr/>Name</span></a><a href="#signalid" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>signal<wbr/>Id</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#dispose" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a><a href="#readstatedata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>State<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writestatedata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>State<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 32 |
+
|
| 33 |
+
<!-- Yandex.Metrika counter -->
|
| 34 |
+
<script type="text/javascript">
|
| 35 |
+
(function(m,e,t,r,i,k,a){
|
| 36 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 37 |
+
m[i].l=1*new Date();
|
| 38 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 39 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 40 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 41 |
+
|
| 42 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 43 |
+
</script>
|
| 44 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 45 |
+
<!-- /Yandex.Metrika counter -->
|
| 46 |
+
|
| 47 |
+
<!-- Google tag (gtag.js) -->
|
| 48 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 49 |
+
<script>
|
| 50 |
+
window.dataLayer = window.dataLayer || [];
|
| 51 |
+
function gtag(){dataLayer.push(arguments);}
|
| 52 |
+
gtag('js', new Date());
|
| 53 |
+
|
| 54 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 55 |
+
</script>
|
classes/types.PersistStorageInstance.html
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PersistStorageInstance | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.PersistStorageInstance.html">PersistStorageInstance</a></li></ul><h1>Class PersistStorageInstance</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Default file-based implementation of IPersistStorageInstance.</p>
|
| 2 |
+
<p>Features:</p>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Each signal stored as separate JSON file keyed by <a href="http://signal.id">signal.id</a></li>
|
| 5 |
+
<li>Read iterates all keys via PersistBase.keys()</li>
|
| 6 |
+
<li>Crash-safe via atomic writes</li>
|
| 7 |
+
</ul>
|
| 8 |
+
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">instance</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">PersistStorageInstance</span><span class="hl-1">(</span><span class="hl-3">false</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">waitForInit</span><span class="hl-1">(</span><span class="hl-3">true</span><span class="hl-1">);</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">writeStorageData</span><span class="hl-1">(</span><span class="hl-4">signals</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">all</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">instance</span><span class="hl-1">.</span><span class="hl-0">readStorageData</span><span class="hl-1">();</span>
|
| 9 |
+
</code><button type="button">Copy</button></pre>
|
| 10 |
+
|
| 11 |
+
</div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../interfaces/types.IPersistStorageInstance.html" class="tsd-signature-type tsd-kind-interface">IPersistStorageInstance</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14244">types.d.ts:14244</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.PersistStorageInstance.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 12 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.PersistStorageInstance.html#backtest" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>backtest</span></a>
|
| 13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.PersistStorageInstance.html#readstoragedata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Storage<wbr/>Data</span></a>
|
| 14 |
+
<a href="types.PersistStorageInstance.html#waitforinit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a>
|
| 15 |
+
<a href="types.PersistStorageInstance.html#writestoragedata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Storage<wbr/>Data</span></a>
|
| 16 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorpersiststorageinstance" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">PersistStorageInstance</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">backtest</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.PersistStorageInstance.html" class="tsd-signature-type tsd-kind-class">PersistStorageInstance</a><a href="#constructorpersiststorageinstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates new signal storage persistence instance.</p>
|
| 17 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">backtest</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>True for backtest mode storage, false for live mode</p>
|
| 18 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.PersistStorageInstance.html" class="tsd-signature-type tsd-kind-class">PersistStorageInstance</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14253">types.d.ts:14253</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="backtest" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>backtest</span><a href="#backtest" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">backtest</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14245">types.d.ts:14245</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="readstoragedata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>read<wbr/>Storage<wbr/>Data</span><a href="#readstoragedata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="readstoragedata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">readStorageData</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.StorageData.html" class="tsd-signature-type tsd-kind-type-alias">StorageData</a><span class="tsd-signature-symbol">></span><a href="#readstoragedata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reads all persisted signals by iterating storage keys.</p>
|
| 19 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../types/types.StorageData.html" class="tsd-signature-type tsd-kind-type-alias">StorageData</a><span class="tsd-signature-symbol">></span></h4><p>Promise resolving to array of signal entries</p>
|
| 20 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistStorageInstance.html">IPersistStorageInstance</a>.<a href="../interfaces/types.IPersistStorageInstance.html#readstoragedata">readStorageData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14266">types.d.ts:14266</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the underlying PersistBase storage.</p>
|
| 21 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization</p>
|
| 22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 23 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistStorageInstance.html">IPersistStorageInstance</a>.<a href="../interfaces/types.IPersistStorageInstance.html#waitforinit">waitForInit</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14260">types.d.ts:14260</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="writestoragedata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write<wbr/>Storage<wbr/>Data</span><a href="#writestoragedata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="writestoragedata-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">writeStorageData</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signals</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.StorageData.html" class="tsd-signature-type tsd-kind-type-alias">StorageData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#writestoragedata-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes each signal as a separate entity keyed by <code>signal.id</code>.</p>
|
| 24 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signals</span>: <a href="../types/types.StorageData.html" class="tsd-signature-type tsd-kind-type-alias">StorageData</a></span><div class="tsd-comment tsd-typography"><p>Signal entries to persist</p>
|
| 25 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when all writes are complete</p>
|
| 26 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of <a href="../interfaces/types.IPersistStorageInstance.html">IPersistStorageInstance</a>.<a href="../interfaces/types.IPersistStorageInstance.html#writestoragedata">writeStorageData</a></p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L14273">types.d.ts:14273</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#backtest" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>backtest</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#readstoragedata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>read<wbr/>Storage<wbr/>Data</span></a><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#writestoragedata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write<wbr/>Storage<wbr/>Data</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 27 |
+
|
| 28 |
+
<!-- Yandex.Metrika counter -->
|
| 29 |
+
<script type="text/javascript">
|
| 30 |
+
(function(m,e,t,r,i,k,a){
|
| 31 |
+
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
| 32 |
+
m[i].l=1*new Date();
|
| 33 |
+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
| 34 |
+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
| 35 |
+
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym');
|
| 36 |
+
|
| 37 |
+
ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true});
|
| 38 |
+
</script>
|
| 39 |
+
<noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
| 40 |
+
<!-- /Yandex.Metrika counter -->
|
| 41 |
+
|
| 42 |
+
<!-- Google tag (gtag.js) -->
|
| 43 |
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script>
|
| 44 |
+
<script>
|
| 45 |
+
window.dataLayer = window.dataLayer || [];
|
| 46 |
+
function gtag(){dataLayer.push(arguments);}
|
| 47 |
+
gtag('js', new Date());
|
| 48 |
+
|
| 49 |
+
gtag('config', 'G-3MQZEBBDDR');
|
| 50 |
+
</script>
|
classes/types.Position.html
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Position | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.Position.html">Position</a></li></ul><h1>Class Position</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Utilities for calculating take profit and stop loss price levels.
|
| 2 |
Automatically inverts direction based on position type (long/short).</p>
|
| 3 |
-
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 4 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.Position.html#bracket" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bracket</span></a>
|
| 5 |
<a href="types.Position.html#moonbag" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>moonbag</span></a>
|
| 6 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorposition" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">Position</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.Position.html" class="tsd-signature-type tsd-kind-class">Position</a><a href="#constructorposition" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.Position.html" class="tsd-signature-type tsd-kind-class">Position</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="bracket" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>bracket</span><a href="#bracket" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bracket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">percentTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div><div class="tsd-comment tsd-typography"><p>Calculates levels for a bracket order with custom TP and SL.</p>
|
|
@@ -9,12 +9,12 @@ Automatically inverts direction based on position type (long/short).</p>
|
|
| 9 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">percentTakeProfit</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>take profit percentage from 0 to 100</p>
|
| 10 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span></h5><div class="tsd-comment tsd-typography"><p>position type: "long" or "short"</p>
|
| 11 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span></h4><p>priceTakeProfit and priceStopLoss in fiat</p>
|
| 12 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 13 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>current asset price</p>
|
| 14 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>stop loss percentage from 0 to 100</p>
|
| 15 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span></h5><div class="tsd-comment tsd-typography"><p>position type: "long" or "short"</p>
|
| 16 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span></h4><p>priceTakeProfit and priceStopLoss in fiat</p>
|
| 17 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 18 |
|
| 19 |
<!-- Yandex.Metrika counter -->
|
| 20 |
<script type="text/javascript">
|
|
|
|
| 1 |
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Position | backtest-kit</title><meta name="description" content="Documentation for backtest-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">backtest-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">backtest-kit</a></li><li><a href="../modules/types.html">types</a></li><li><a href="types.Position.html">Position</a></li></ul><h1>Class Position</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Utilities for calculating take profit and stop loss price levels.
|
| 2 |
Automatically inverts direction based on position type (long/short).</p>
|
| 3 |
+
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L21467">types.d.ts:21467</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.Position.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 4 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.Position.html#bracket" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bracket</span></a>
|
| 5 |
<a href="types.Position.html#moonbag" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>moonbag</span></a>
|
| 6 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorposition" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">Position</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.Position.html" class="tsd-signature-type tsd-kind-class">Position</a><a href="#constructorposition" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.Position.html" class="tsd-signature-type tsd-kind-class">Position</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="bracket" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>bracket</span><a href="#bracket" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bracket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">percentTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div><div class="tsd-comment tsd-typography"><p>Calculates levels for a bracket order with custom TP and SL.</p>
|
|
|
|
| 9 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">percentTakeProfit</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>take profit percentage from 0 to 100</p>
|
| 10 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span></h5><div class="tsd-comment tsd-typography"><p>position type: "long" or "short"</p>
|
| 11 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span></h4><p>priceTakeProfit and priceStopLoss in fiat</p>
|
| 12 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L21492">types.d.ts:21492</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="moonbag" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>moonbag</span><a href="#moonbag" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">moonbag</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div><div class="tsd-comment tsd-typography"><p>Calculates levels for the "moonbag" strategy — fixed TP at 50% from the current price.</p>
|
| 13 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">currentPrice</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>current asset price</p>
|
| 14 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">percentStopLoss</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>stop loss percentage from 0 to 100</p>
|
| 15 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span></h5><div class="tsd-comment tsd-typography"><p>position type: "long" or "short"</p>
|
| 16 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"long"</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">"short"</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceStopLoss</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">priceTakeProfit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span> <span class="tsd-signature-symbol">}</span></h4><p>priceTakeProfit and priceStopLoss in fiat</p>
|
| 17 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L21475">types.d.ts:21475</a></li></ul></aside></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#bracket" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bracket</span></a><a href="#moonbag" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>moonbag</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 18 |
|
| 19 |
<!-- Yandex.Metrika counter -->
|
| 20 |
<script type="text/javascript">
|
classes/types.ReportBase.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
<p>File format: ./dump/report/{reportName}.jsonl
|
| 12 |
Each line contains: reportName, data, metadata, timestamp</p>
|
| 13 |
<p>Use this adapter for event logging and post-processing analytics.</p>
|
| 14 |
-
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../types/types.TReportBase.html" class="tsd-signature-type tsd-kind-type-alias">TReportBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 15 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.ReportBase.html#_filepath" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_file<wbr/>Path</span></a>
|
| 16 |
<a href="types.ReportBase.html#_stream" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_stream</span></a>
|
| 17 |
<a href="types.ReportBase.html#wait_for_init_symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span></a>
|
|
@@ -23,19 +23,19 @@ Each line contains: reportName, data, metadata, timestamp</p>
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorreportbase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">ReportBase</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">reportName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IReportTarget</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">baseDir</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.ReportBase.html" class="tsd-signature-type tsd-kind-class">ReportBase</a><a href="#constructorreportbase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new JSONL report adapter instance.</p>
|
| 24 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">reportName</span>: <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IReportTarget</span></span><div class="tsd-comment tsd-typography"><p>Type of report (backtest, live, walker, etc.)</p>
|
| 25 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">baseDir</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Base directory for report files, defaults to ./dump/report</p>
|
| 26 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.ReportBase.html" class="tsd-signature-type tsd-kind-class">ReportBase</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 27 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 28 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 29 |
Protected by singleshot to ensure one-time execution.
|
| 30 |
Sets up error handler that emits to exitEmitter.</p>
|
| 31 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 32 |
Waits for drain event if write buffer is full.
|
| 33 |
Times out after 15 seconds and returns TIMEOUT_SYMBOL.</p>
|
| 34 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 35 |
Safe to call multiple times - singleshot ensures one-time execution.</p>
|
| 36 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization (informational only)</p>
|
| 37 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 38 |
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TReportBase.waitForInit</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 39 |
Appends a single line with JSON object containing:</p>
|
| 40 |
<ul>
|
| 41 |
<li>reportName: Type of report</li>
|
|
@@ -46,7 +46,7 @@ Appends a single line with JSON object containing:</p>
|
|
| 46 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="writet" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span> = <span class="tsd-signature-type">any</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="types.ReportBase.html#writet">T</a></span><div class="tsd-comment tsd-typography"><p>Event data object to write</p>
|
| 47 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.IReportDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IReportDumpOptions</a></span><div class="tsd-comment tsd-typography"><p>Metadata options for filtering and search</p>
|
| 48 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if stream not initialized or write timeout exceeded</p>
|
| 49 |
-
</div></div><aside class="tsd-sources"><p>Implementation of TReportBase.write</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 50 |
|
| 51 |
<!-- Yandex.Metrika counter -->
|
| 52 |
<script type="text/javascript">
|
|
|
|
| 11 |
<p>File format: ./dump/report/{reportName}.jsonl
|
| 12 |
Each line contains: reportName, data, metadata, timestamp</p>
|
| 13 |
<p>Use this adapter for event logging and post-processing analytics.</p>
|
| 14 |
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../types/types.TReportBase.html" class="tsd-signature-type tsd-kind-type-alias">TReportBase</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16285">types.d.ts:16285</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.ReportBase.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 15 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.ReportBase.html#_filepath" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_file<wbr/>Path</span></a>
|
| 16 |
<a href="types.ReportBase.html#_stream" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_stream</span></a>
|
| 17 |
<a href="types.ReportBase.html#wait_for_init_symbol" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span></a>
|
|
|
|
| 23 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorreportbase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">ReportBase</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">reportName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IReportTarget</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">baseDir</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="types.ReportBase.html" class="tsd-signature-type tsd-kind-class">ReportBase</a><a href="#constructorreportbase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new JSONL report adapter instance.</p>
|
| 24 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">reportName</span>: <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IReportTarget</span></span><div class="tsd-comment tsd-typography"><p>Type of report (backtest, live, walker, etc.)</p>
|
| 25 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">baseDir</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Base directory for report files, defaults to ./dump/report</p>
|
| 26 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.ReportBase.html" class="tsd-signature-type tsd-kind-class">ReportBase</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16298">types.d.ts:16298</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="_filepath" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_file<wbr/>Path</span><a href="#_filepath" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">_filePath</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>Absolute path to the JSONL file for this report type</p>
|
| 27 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16289">types.d.ts:16289</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="_stream" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>_stream</span><a href="#_stream" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">_stream</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">WriteStream</span></div><div class="tsd-comment tsd-typography"><p>WriteStream instance for append-only writes, null until initialized</p>
|
| 28 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16291">types.d.ts:16291</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="wait_for_init_symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>[WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span><a href="#wait_for_init_symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">"[WAIT_FOR_INIT_SYMBOL]"</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">&</span> <span class="tsd-signature-type">ISingleshotClearable</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Singleshot initialization function that creates directory and stream.
|
| 29 |
Protected by singleshot to ensure one-time execution.
|
| 30 |
Sets up error handler that emits to exitEmitter.</p>
|
| 31 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16304">types.d.ts:16304</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="write_safe_symbol" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>[WRITE_<wbr/>SAFE_<wbr/>SYMBOL]</span><a href="#write_safe_symbol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">"[WRITE_SAFE_SYMBOL]"</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IWrappedQueuedFn</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">symbol</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-symbol">[</span>line<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Timeout-protected write function with backpressure handling.
|
| 32 |
Waits for drain event if write buffer is full.
|
| 33 |
Times out after 15 seconds and returns TIMEOUT_SYMBOL.</p>
|
| 34 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16310">types.d.ts:16310</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="basedir" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>base<wbr/>Dir</span><a href="#basedir" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">baseDir</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16287">types.d.ts:16287</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="reportname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>report<wbr/>Name</span><a href="#reportname" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">reportName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">keyof</span> <span class="tsd-signature-type">IReportTarget</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16286">types.d.ts:16286</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="waitforinit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>wait<wbr/>For<wbr/>Init</span><a href="#waitforinit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="waitforinit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">waitForInit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">initial</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#waitforinit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the JSONL file and write stream.
|
| 35 |
Safe to call multiple times - singleshot ensures one-time execution.</p>
|
| 36 |
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">initial</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Whether this is the first initialization (informational only)</p>
|
| 37 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves when initialization is complete</p>
|
| 38 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TReportBase.waitForInit</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16318">types.d.ts:16318</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="write" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>write</span><a href="#write" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="write-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">write</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="types.ReportBase.html#writet">T</a> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="types.ReportBase.html#writet">T</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.IReportDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IReportDumpOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#write-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Writes event data to JSONL file with metadata.
|
| 39 |
Appends a single line with JSON object containing:</p>
|
| 40 |
<ul>
|
| 41 |
<li>reportName: Type of report</li>
|
|
|
|
| 46 |
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="writet" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span> = <span class="tsd-signature-type">any</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="types.ReportBase.html#writet">T</a></span><div class="tsd-comment tsd-typography"><p>Event data object to write</p>
|
| 47 |
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.IReportDumpOptions.html" class="tsd-signature-type tsd-kind-interface">IReportDumpOptions</a></span><div class="tsd-comment tsd-typography"><p>Metadata options for filtering and search</p>
|
| 48 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Error if stream not initialized or write timeout exceeded</p>
|
| 49 |
+
</div></div><aside class="tsd-sources"><p>Implementation of TReportBase.write</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L16331">types.d.ts:16331</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#_filepath" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_file<wbr/>Path</span></a><a href="#_stream" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>_stream</span></a><a href="#wait_for_init_symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[WAIT_<wbr/>FOR_<wbr/>INIT_<wbr/>SYMBOL]</span></a><a href="#write_safe_symbol" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>[WRITE_<wbr/>SAFE_<wbr/>SYMBOL]</span></a><a href="#basedir" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>base<wbr/>Dir</span></a><a href="#reportname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>report<wbr/>Name</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#waitforinit" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>wait<wbr/>For<wbr/>Init</span></a><a href="#write" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>write</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 50 |
|
| 51 |
<!-- Yandex.Metrika counter -->
|
| 52 |
<script type="text/javascript">
|
classes/types.StateBacktestAdapter.html
CHANGED
|
@@ -13,7 +13,7 @@ SL trades never go positive (Feb25) or show peak < 0.15% (Feb08, Feb13).
|
|
| 13 |
Rule: if position open >= N minutes and peakPercent < threshold (e.g. 0.3%),
|
| 14 |
the LLM thesis was not confirmed by market — exit immediately.
|
| 15 |
State tracks <code>{ peakPercent, minutesOpen }</code> per signal across onActivePing ticks.</p>
|
| 16 |
-
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TStateAdapter</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 17 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.StateBacktestAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 18 |
<a href="types.StateBacktestAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 19 |
<a href="types.StateBacktestAdapter.html#getstate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>get<wbr/>State</span></a>
|
|
@@ -25,28 +25,30 @@ State tracks <code>{ peakPercent, minutesOpen }</code> per signal across onActiv
|
|
| 25 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorstatebacktestadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">StateBacktestAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.StateBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">StateBacktestAdapter</a><a href="#constructorstatebacktestadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.StateBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">StateBacktestAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 26 |
Call this when process.cwd() changes between strategy iterations
|
| 27 |
so new instances are created with the updated base path.</p>
|
| 28 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 29 |
Called by StateAdapter when a signal is cancelled or closed.</p>
|
| 30 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 31 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 32 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 34 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 35 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Current state value</p>
|
| 36 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.getState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 37 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dispatch</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span>
|
| 38 |
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 39 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 40 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 41 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Updated state value</p>
|
| 42 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.setState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 43 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 44 |
All data lives in process memory only.</p>
|
| 45 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 46 |
Data is persisted to disk via PersistStateAdapter.</p>
|
| 47 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 48 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom state instance</p>
|
| 49 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 50 |
|
| 51 |
<!-- Yandex.Metrika counter -->
|
| 52 |
<script type="text/javascript">
|
|
|
|
| 13 |
Rule: if position open >= N minutes and peakPercent < threshold (e.g. 0.3%),
|
| 14 |
the LLM thesis was not confirmed by market — exit immediately.
|
| 15 |
State tracks <code>{ peakPercent, minutesOpen }</code> per signal across onActivePing ticks.</p>
|
| 16 |
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TStateAdapter</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9773">types.d.ts:9773</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.StateBacktestAdapter.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 17 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.StateBacktestAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 18 |
<a href="types.StateBacktestAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 19 |
<a href="types.StateBacktestAdapter.html#getstate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>get<wbr/>State</span></a>
|
|
|
|
| 25 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorstatebacktestadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">StateBacktestAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.StateBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">StateBacktestAdapter</a><a href="#constructorstatebacktestadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.StateBacktestAdapter.html" class="tsd-signature-type tsd-kind-class">StateBacktestAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 26 |
Call this when process.cwd() changes between strategy iterations
|
| 27 |
so new instances are created with the updated base path.</p>
|
| 28 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9835">types.d.ts:9835</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="disposesignal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose<wbr/>Signal</span><a href="#disposesignal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">disposeSignal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Disposes all memoized instances for the given signalId.
|
| 29 |
Called by StateAdapter when a signal is cancelled or closed.</p>
|
| 30 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 31 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9781">types.d.ts:9781</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="getstate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>State</span><a href="#getstate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">getState</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Read the current state value for a signal.</p>
|
| 32 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Value</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 34 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 35 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the read is happening (look-ahead guard)</p>
|
| 36 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Current state value</p>
|
| 37 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.getState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9790">types.d.ts:9790</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="setstate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>State</span><a href="#setstate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">setState</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dispatch</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Update the state value for a signal.</p>
|
| 38 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dispatch</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Value</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dispatch</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>New value or updater function receiving current value</p>
|
| 39 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 40 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 41 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 42 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp this value belongs to</p>
|
| 43 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Updated state value</p>
|
| 44 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.setState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9805">types.d.ts:9805</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usedummy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Dummy</span><a href="#usedummy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useDummy</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to dummy adapter that discards all writes.</p>
|
| 45 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9824">types.d.ts:9824</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="uselocal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Local</span><a href="#uselocal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useLocal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to in-memory adapter (default).
|
| 46 |
All data lives in process memory only.</p>
|
| 47 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9815">types.d.ts:9815</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usepersist" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Persist</span><a href="#usepersist" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">usePersist</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to file-system backed adapter.
|
| 48 |
Data is persisted to disk via PersistStateAdapter.</p>
|
| 49 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9820">types.d.ts:9820</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usestateadapter" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>State<wbr/>Adapter</span><a href="#usestateadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useStateAdapter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to a custom state adapter implementation.</p>
|
| 50 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom state instance</p>
|
| 51 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9829">types.d.ts:9829</a></li></ul></aside></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#clear" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a><a href="#disposesignal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a><a href="#getstate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>get<wbr/>State</span></a><a href="#setstate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>set<wbr/>State</span></a><a href="#usedummy" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Dummy</span></a><a href="#uselocal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Local</span></a><a href="#usepersist" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Persist</span></a><a href="#usestateadapter" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>State<wbr/>Adapter</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 52 |
|
| 53 |
<!-- Yandex.Metrika counter -->
|
| 54 |
<script type="text/javascript">
|
classes/types.StateLiveAdapter.html
CHANGED
|
@@ -13,7 +13,7 @@ SL trades never go positive (Feb25) or show peak < 0.15% (Feb08, Feb13).
|
|
| 13 |
Rule: if position open >= N minutes and peakPercent < threshold (e.g. 0.3%),
|
| 14 |
the LLM thesis was not confirmed by market — exit immediately.
|
| 15 |
State persists <code>{ peakPercent, minutesOpen }</code> per signal across process restarts.</p>
|
| 16 |
-
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TStateAdapter</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 17 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.StateLiveAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 18 |
<a href="types.StateLiveAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 19 |
<a href="types.StateLiveAdapter.html#getstate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>get<wbr/>State</span></a>
|
|
@@ -25,28 +25,30 @@ State persists <code>{ peakPercent, minutesOpen }</code> per signal across proce
|
|
| 25 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorstateliveadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">StateLiveAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.StateLiveAdapter.html" class="tsd-signature-type tsd-kind-class">StateLiveAdapter</a><a href="#constructorstateliveadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.StateLiveAdapter.html" class="tsd-signature-type tsd-kind-class">StateLiveAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 26 |
Call this when process.cwd() changes between strategy iterations
|
| 27 |
so new instances are created with the updated base path.</p>
|
| 28 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 29 |
Called by StateAdapter when a signal is cancelled or closed.</p>
|
| 30 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 31 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 32 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 34 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 35 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Current state value</p>
|
| 36 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.getState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 37 |
-
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dispatch</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span>
|
| 38 |
-
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 39 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 40 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
|
|
|
| 41 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Updated state value</p>
|
| 42 |
-
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.setState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 43 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 44 |
All data lives in process memory only.</p>
|
| 45 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 46 |
Data is persisted to disk via PersistStateAdapter.</p>
|
| 47 |
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 48 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom state instance</p>
|
| 49 |
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/
|
| 50 |
|
| 51 |
<!-- Yandex.Metrika counter -->
|
| 52 |
<script type="text/javascript">
|
|
|
|
| 13 |
Rule: if position open >= N minutes and peakPercent < threshold (e.g. 0.3%),
|
| 14 |
the LLM thesis was not confirmed by market — exit immediately.
|
| 15 |
State persists <code>{ peakPercent, minutesOpen }</code> per signal across process restarts.</p>
|
| 16 |
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">TStateAdapter</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9854">types.d.ts:9854</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="types.StateLiveAdapter.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
| 17 |
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.StateLiveAdapter.html#clear" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a>
|
| 18 |
<a href="types.StateLiveAdapter.html#disposesignal" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a>
|
| 19 |
<a href="types.StateLiveAdapter.html#getstate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>get<wbr/>State</span></a>
|
|
|
|
| 25 |
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorstateliveadapter" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">StateLiveAdapter</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="types.StateLiveAdapter.html" class="tsd-signature-type tsd-kind-class">StateLiveAdapter</a><a href="#constructorstateliveadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="types.StateLiveAdapter.html" class="tsd-signature-type tsd-kind-class">StateLiveAdapter</a></h4></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="clear" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>clear</span><a href="#clear" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">clear</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Clears the memoized instance cache.
|
| 26 |
Call this when process.cwd() changes between strategy iterations
|
| 27 |
so new instances are created with the updated base path.</p>
|
| 28 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9916">types.d.ts:9916</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="disposesignal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose<wbr/>Signal</span><a href="#disposesignal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">disposeSignal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Disposes all memoized instances for the given signalId.
|
| 29 |
Called by StateAdapter when a signal is cancelled or closed.</p>
|
| 30 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">signalId</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Signal identifier to dispose</p>
|
| 31 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9862">types.d.ts:9862</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="getstate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>State</span><a href="#getstate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">getState</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Read the current state value for a signal.</p>
|
| 32 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Value</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 33 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 34 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 35 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp at which the read is happening (look-ahead guard)</p>
|
| 36 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Current state value</p>
|
| 37 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.getState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9871">types.d.ts:9871</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="setstate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>State</span><a href="#setstate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">setState</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dispatch</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>Update the state value for a signal.</p>
|
| 38 |
+
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-type">object</span> <span class="tsd-signature-symbol">=</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">dispatch</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">dto</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a class="tsd-anchor"></a><span class="tsd-kind-type-parameter">Value</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">object</span> = <span class="tsd-signature-type">object</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dispatch</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Dispatch</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></span><div class="tsd-comment tsd-typography"><p>New value or updater function receiving current value</p>
|
| 39 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">dto</span>: <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span> <span class="tsd-signature-symbol">}</span></span><ul class="tsd-parameters"><li class="tsd-parameter"><h5><span class="tsd-kind-property">bucketName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Bucket name</p>
|
| 40 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">initialValue</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>Default value when no persisted state exists</p>
|
| 41 |
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">signalId</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Signal identifier</p>
|
| 42 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">when</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Date</span></h5><div class="tsd-comment tsd-typography"><p>Logical timestamp this value belongs to</p>
|
| 43 |
</div><div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="">Value</a><span class="tsd-signature-symbol">></span></h4><p>Updated state value</p>
|
| 44 |
+
<div class="tsd-comment tsd-typography"></div></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of TStateAdapter.setState</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9886">types.d.ts:9886</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usedummy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Dummy</span><a href="#usedummy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useDummy</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to dummy adapter that discards all writes.</p>
|
| 45 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9905">types.d.ts:9905</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="uselocal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Local</span><a href="#uselocal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useLocal</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to in-memory adapter.
|
| 46 |
All data lives in process memory only.</p>
|
| 47 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9896">types.d.ts:9896</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usepersist" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>Persist</span><a href="#usepersist" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">usePersist</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to file-system backed adapter (default).
|
| 48 |
Data is persisted to disk via PersistStateAdapter.</p>
|
| 49 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9901">types.d.ts:9901</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="usestateadapter" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use<wbr/>State<wbr/>Adapter</span><a href="#usestateadapter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">useStateAdapter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-comment tsd-typography"><p>Switches to a custom state adapter implementation.</p>
|
| 50 |
</div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">Ctor</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">Ctor</span>: <a href="../types/types.TStateInstanceCtor.html" class="tsd-signature-type tsd-kind-type-alias">TStateInstanceCtor</a></span><div class="tsd-comment tsd-typography"><p>Constructor for the custom state instance</p>
|
| 51 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/6b69cabc5533b881de84ecaeeb4dea1130dc1a1b/types.d.ts#L9910">types.d.ts:9910</a></li></ul></aside></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#clear" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>clear</span></a><a href="#disposesignal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>dispose<wbr/>Signal</span></a><a href="#getstate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>get<wbr/>State</span></a><a href="#setstate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>set<wbr/>State</span></a><a href="#usedummy" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Dummy</span></a><a href="#uselocal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Local</span></a><a href="#usepersist" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>Persist</span></a><a href="#usestateadapter" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use<wbr/>State<wbr/>Adapter</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
| 52 |
|
| 53 |
<!-- Yandex.Metrika counter -->
|
| 54 |
<script type="text/javascript">
|
documents/article_01_look_ahead_bias.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
documents/article_02_second_order_chaos.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
documents/article_03_claude_trader.html
CHANGED
|
@@ -18,15 +18,15 @@
|
|
| 18 |
<p><strong>The iteration cost is too high due to clumsy human hands</strong>: the number of CSV files either turns the downloads folder into a mess, or running a week's worth of backtest time takes a day of thoughtful work because you need to name and organize files into folders. A human physically can't work that long.</p>
|
| 19 |
<p>And you can also send the wrong file to the chat and catch look-ahead bias.</p>
|
| 20 |
<a id="the-architectural-flaw-of-pine-script" class="tsd-anchor"></a><h2 class="tsd-anchor-link">The Architectural Flaw of Pine Script<a href="#the-architectural-flaw-of-pine-script" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The Pine Script language is syntactic sugar for a for loop where variables are declared both inside and outside the loop block.</p>
|
| 21 |
-
<pre><code class="javascript"><span class="hl-6">// Local in the candle iteration loop</span><br/><span class="hl-
|
| 22 |
</code><button type="button">Copy</button></pre>
|
| 23 |
|
| 24 |
<p>As a consequence, if you need to wait for favorable conditions on both fast (15m) and long (4h) timeframes, you get workarounds:</p>
|
| 25 |
-
<pre><code class="javascript"><span class="hl-
|
| 26 |
</code><button type="button">Copy</button></pre>
|
| 27 |
|
| 28 |
<p>The closest analogy to this code from mathematics is a complex number. The number itself means nothing: you need the dynamics of change in a series of numbers (whether it's generally growing or falling). And double for loops are inefficient (quadratic complexity), so they weren't implemented. And it's also unclear what <code>barmerge.lookahead_off</code> does.</p>
|
| 29 |
-
<pre><code class="javascript"><span class="hl-6">// Is this correct?</span><br/><span class="hl-
|
| 30 |
</code><button type="button">Copy</button></pre>
|
| 31 |
|
| 32 |
<p>Things are even more fun with breakeven math: this code is unreadable, any language model hallucination will indistinguishably create a loss. Meanwhile, the programmer will be convinced that the problem is in the indicators.</p>
|
|
@@ -55,7 +55,7 @@
|
|
| 55 |
</ol>
|
| 56 |
<p>Additionally, since everything is open source, this can be run on any exchange, including those not available in TradingView or where the company has disabled the broker.</p>
|
| 57 |
<a id="fixing-pine-script" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Fixing Pine Script<a href="#fixing-pine-script" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>To combine data from different timeframes, you need to run two separate indicators simultaneously. The complete program code <a href="https://github.com/tripolskypetr/backtest-kit">at the link</a> already contains a caching mechanism for the higher 4h timeframe, calculations are optimized.</p>
|
| 58 |
-
<pre><code class="typescript"><span class="hl-
|
| 59 |
</code><button type="button">Copy</button></pre>
|
| 60 |
|
| 61 |
<a id="how-claude-code-uses-this" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How Claude Code Uses This<a href="#how-claude-code-uses-this" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><blockquote>
|
|
@@ -69,11 +69,11 @@
|
|
| 69 |
</code><button type="button">Copy</button></pre>
|
| 70 |
|
| 71 |
<p><em><strong>Claude Code</strong></em>: <em>I see a template with EMA crossover. Modifying it for RSI divergence...</em></p>
|
| 72 |
-
<pre><code class="javascript"><span class="hl-1"># </span><span class="hl-
|
| 73 |
</code><button type="button">Copy</button></pre>
|
| 74 |
|
| 75 |
<p><strong>Claude Code</strong>: <em>Running backtest on October 2025 (crypto crash period)...</em></p>
|
| 76 |
-
<pre><code class="javascript"><span class="hl-
|
| 77 |
</code><button type="button">Copy</button></pre>
|
| 78 |
|
| 79 |
<p><em><strong>Backtest Results:</strong></em></p>
|
|
|
|
| 18 |
<p><strong>The iteration cost is too high due to clumsy human hands</strong>: the number of CSV files either turns the downloads folder into a mess, or running a week's worth of backtest time takes a day of thoughtful work because you need to name and organize files into folders. A human physically can't work that long.</p>
|
| 19 |
<p>And you can also send the wrong file to the chat and catch look-ahead bias.</p>
|
| 20 |
<a id="the-architectural-flaw-of-pine-script" class="tsd-anchor"></a><h2 class="tsd-anchor-link">The Architectural Flaw of Pine Script<a href="#the-architectural-flaw-of-pine-script" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The Pine Script language is syntactic sugar for a for loop where variables are declared both inside and outside the loop block.</p>
|
| 21 |
+
<pre><code class="javascript"><span class="hl-6">// Local in the candle iteration loop</span><br/><span class="hl-4">long_cond</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">crossover</span><span class="hl-1">(</span><span class="hl-4">ema_fast</span><span class="hl-1">, </span><span class="hl-4">ema_slow</span><span class="hl-1">) </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> > </span><span class="hl-7">40</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> < </span><span class="hl-7">65</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">trend_up</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">vol_spike</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">mom_up</span><span class="hl-1"> </span><br/><span class="hl-4">short_cond</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">crossunder</span><span class="hl-1">(</span><span class="hl-4">ema_fast</span><span class="hl-1">, </span><span class="hl-4">ema_slow</span><span class="hl-1">) </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> < </span><span class="hl-7">60</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> > </span><span class="hl-7">35</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">trend_down</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">vol_spike</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">mom_down</span><br/><br/><span class="hl-6">// Global outside the loop</span><br/><span class="hl-3">var</span><span class="hl-1"> </span><span class="hl-4">int</span><span class="hl-1"> bars_since_signal = </span><span class="hl-7">0</span>
|
| 22 |
</code><button type="button">Copy</button></pre>
|
| 23 |
|
| 24 |
<p>As a consequence, if you need to wait for favorable conditions on both fast (15m) and long (4h) timeframes, you get workarounds:</p>
|
| 25 |
+
<pre><code class="javascript"><span class="hl-4">ema200_4h</span><span class="hl-1"> = </span><span class="hl-4">request</span><span class="hl-1">.</span><span class="hl-0">security</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-4">syminfo</span><span class="hl-1">.</span><span class="hl-4">tickerid</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">"240"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">ema</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-7">200</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-4">lookahead</span><span class="hl-1"> = </span><span class="hl-4">barmerge</span><span class="hl-1">.</span><span class="hl-4">lookahead_off</span><br/><span class="hl-1">)</span>
|
| 26 |
</code><button type="button">Copy</button></pre>
|
| 27 |
|
| 28 |
<p>The closest analogy to this code from mathematics is a complex number. The number itself means nothing: you need the dynamics of change in a series of numbers (whether it's generally growing or falling). And double for loops are inefficient (quadratic complexity), so they weren't implemented. And it's also unclear what <code>barmerge.lookahead_off</code> does.</p>
|
| 29 |
+
<pre><code class="javascript"><span class="hl-6">// Is this correct?</span><br/><span class="hl-4">breakeven</span><span class="hl-1"> = </span><span class="hl-4">entryPrice</span><span class="hl-1"> * (</span><span class="hl-7">1</span><span class="hl-1"> + </span><span class="hl-4">commissionPct</span><span class="hl-1"> * </span><span class="hl-7">2</span><span class="hl-1"> + </span><span class="hl-4">slippagePct</span><span class="hl-1"> * </span><span class="hl-7">2</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// Or this?</span><br/><span class="hl-4">breakeven</span><span class="hl-1"> = </span><span class="hl-4">entryPrice</span><span class="hl-1"> * (</span><span class="hl-7">1</span><span class="hl-1"> + </span><span class="hl-4">entryFee</span><span class="hl-1">) / (</span><span class="hl-7">1</span><span class="hl-1"> - </span><span class="hl-4">exitFee</span><span class="hl-1"> - </span><span class="hl-4">slippage</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// Or maybe this?</span><br/><span class="hl-10">trueBreakeven</span><span class="hl-1"> := </span><span class="hl-4">entryPrice</span><span class="hl-1"> * (</span><span class="hl-7">1</span><span class="hl-1"> + </span><span class="hl-4">entryCommission</span><span class="hl-1">) / (</span><span class="hl-7">1</span><span class="hl-1"> - </span><span class="hl-4">exitCommission</span><span class="hl-1"> - </span><span class="hl-4">slippage</span><span class="hl-1">) * (</span><span class="hl-7">1</span><span class="hl-1"> + </span><span class="hl-4">fundingRate</span><span class="hl-1"> * </span><span class="hl-4">holdingPeriod</span><span class="hl-1"> / </span><span class="hl-7">8</span><span class="hl-1">)</span>
|
| 30 |
</code><button type="button">Copy</button></pre>
|
| 31 |
|
| 32 |
<p>Things are even more fun with breakeven math: this code is unreadable, any language model hallucination will indistinguishably create a loss. Meanwhile, the programmer will be convinced that the problem is in the indicators.</p>
|
|
|
|
| 55 |
</ol>
|
| 56 |
<p>Additionally, since everything is open source, this can be run on any exchange, including those not available in TradingView or where the company has disabled the broker.</p>
|
| 57 |
<a id="fixing-pine-script" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Fixing Pine Script<a href="#fixing-pine-script" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>To combine data from different timeframes, you need to run two separate indicators simultaneously. The complete program code <a href="https://github.com/tripolskypetr/backtest-kit">at the link</a> already contains a caching mechanism for the higher 4h timeframe, calculations are optimized.</p>
|
| 58 |
+
<pre><code class="typescript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">addStrategySchema</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">randomString</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"functools-kit"</span><span class="hl-1">;</span><br/><br/><span class="hl-5">import</span><span class="hl-1"> </span><span class="hl-3">*</span><span class="hl-1"> </span><span class="hl-5">as</span><span class="hl-1"> </span><span class="hl-4">math_15m</span><span class="hl-1"> </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"../../math/timeframe_15m.math.mjs"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> </span><span class="hl-3">*</span><span class="hl-1"> </span><span class="hl-5">as</span><span class="hl-1"> </span><span class="hl-4">math_4h</span><span class="hl-1"> </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"../../math/timeframe_4h.math.mjs"</span><span class="hl-1">;</span><br/><br/><span class="hl-5">import</span><span class="hl-1"> </span><span class="hl-4">StrategyName</span><span class="hl-1"> </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"../../enum/StrategyName.mjs"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> </span><span class="hl-4">RiskName</span><span class="hl-1"> </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"../../enum/RiskName.mjs"</span><span class="hl-1">;</span><br/><br/><span class="hl-0">addStrategySchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">strategyName:</span><span class="hl-1"> </span><span class="hl-4">StrategyName</span><span class="hl-1">.</span><span class="hl-4">MainStrategy</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"5m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getSignal</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">signalId</span><span class="hl-1"> = </span><span class="hl-0">randomString</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data_4h</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">math_4h</span><span class="hl-1">.</span><span class="hl-0">getData</span><span class="hl-1">(</span><span class="hl-4">signalId</span><span class="hl-1">, </span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">// await pinescript.run(</span><br/><span class="hl-1"> </span><span class="hl-6">// File.fromPath("timeframe_4h.pine"), </span><br/><span class="hl-1"> </span><span class="hl-6">// { symbol, timeframe: "4h", limit: 100 }</span><br/><span class="hl-1"> </span><span class="hl-6">// )</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_4h</span><span class="hl-1">.</span><span class="hl-4">noTrades</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data_15m</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">math_15m</span><span class="hl-1">.</span><span class="hl-0">getData</span><span class="hl-1">(</span><span class="hl-4">signalId</span><span class="hl-1">, </span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">// await run(</span><br/><span class="hl-1"> </span><span class="hl-6">// File.fromPath("timeframe_15m.pine"), </span><br/><span class="hl-1"> </span><span class="hl-6">// { symbol, timeframe: "15m", limit: 100 }</span><br/><span class="hl-1"> </span><span class="hl-6">// )</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_15m</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === </span><span class="hl-7">0</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_4h</span><span class="hl-1">.</span><span class="hl-4">allowShort</span><span class="hl-1"> && </span><span class="hl-4">data_15m</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === </span><span class="hl-7">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_4h</span><span class="hl-1">.</span><span class="hl-4">allowLong</span><span class="hl-1"> && </span><span class="hl-4">data_15m</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === -</span><span class="hl-7">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">math_15m</span><span class="hl-1">.</span><span class="hl-0">dumpPlot</span><span class="hl-1">(</span><span class="hl-4">signalId</span><span class="hl-1">, </span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">math_4h</span><span class="hl-1">.</span><span class="hl-0">dumpPlot</span><span class="hl-1">(</span><span class="hl-4">signalId</span><span class="hl-1">, </span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">math_15m</span><span class="hl-1">.</span><span class="hl-0">getSignal</span><span class="hl-1">(</span><span class="hl-4">signalId</span><span class="hl-1">, </span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">riskList:</span><span class="hl-1"> [</span><br/><span class="hl-1"> </span><span class="hl-4">RiskName</span><span class="hl-1">.</span><span class="hl-4">TakeProfitDistanceRisk</span><span class="hl-1">, </span><br/><span class="hl-1"> </span><span class="hl-4">RiskName</span><span class="hl-1">.</span><span class="hl-4">StopLossDistanceRisk</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1">});</span>
|
| 59 |
</code><button type="button">Copy</button></pre>
|
| 60 |
|
| 61 |
<a id="how-claude-code-uses-this" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How Claude Code Uses This<a href="#how-claude-code-uses-this" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><blockquote>
|
|
|
|
| 69 |
</code><button type="button">Copy</button></pre>
|
| 70 |
|
| 71 |
<p><em><strong>Claude Code</strong></em>: <em>I see a template with EMA crossover. Modifying it for RSI divergence...</em></p>
|
| 72 |
+
<pre><code class="javascript"><span class="hl-1"># </span><span class="hl-4">Edits</span><span class="hl-1"> </span><span class="hl-4">Pine</span><span class="hl-1"> </span><span class="hl-4">Script</span><span class="hl-1"> </span><span class="hl-4">strategy</span><br/><span class="hl-4">cat</span><span class="hl-1"> > </span><span class="hl-4">config</span><span class="hl-1">/</span><span class="hl-4">source</span><span class="hl-1">/</span><span class="hl-4">rsi_divergence</span><span class="hl-1">.</span><span class="hl-4">pine</span><span class="hl-1"> << </span><span class="hl-2">'EOF'</span><br/><span class="hl-6">//@version=5</span><br/><span class="hl-0">indicator</span><span class="hl-1">(</span><span class="hl-2">"RSI Divergence Strategy"</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// RSI calculation</span><br/><span class="hl-4">rsi</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">rsi</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-7">14</span><span class="hl-1">)</span><br/><span class="hl-4">rsi_prev</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">rsi</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">], </span><span class="hl-7">14</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// Price divergence detection</span><br/><span class="hl-4">bullish_div</span><span class="hl-1"> = </span><span class="hl-4">close</span><span class="hl-1"> < </span><span class="hl-4">close</span><span class="hl-1">[</span><span class="hl-7">5</span><span class="hl-1">] </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> > </span><span class="hl-4">rsi</span><span class="hl-1">[</span><span class="hl-7">5</span><span class="hl-1">] </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> < </span><span class="hl-7">35</span><br/><span class="hl-4">bearish_div</span><span class="hl-1"> = </span><span class="hl-4">close</span><span class="hl-1"> > </span><span class="hl-4">close</span><span class="hl-1">[</span><span class="hl-7">5</span><span class="hl-1">] </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> < </span><span class="hl-4">rsi</span><span class="hl-1">[</span><span class="hl-7">5</span><span class="hl-1">] </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1"> > </span><span class="hl-7">65</span><br/><br/><span class="hl-6">// Volume confirmation</span><br/><span class="hl-4">vol_spike</span><span class="hl-1"> = </span><span class="hl-4">volume</span><span class="hl-1"> > </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">sma</span><span class="hl-1">(</span><span class="hl-4">volume</span><span class="hl-1">, </span><span class="hl-7">20</span><span class="hl-1">) * </span><span class="hl-7">1.5</span><br/><br/><span class="hl-6">// Signals</span><br/><span class="hl-4">long_signal</span><span class="hl-1"> = </span><span class="hl-4">bullish_div</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">vol_spike</span><br/><span class="hl-4">short_signal</span><span class="hl-1"> = </span><span class="hl-4">bearish_div</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">vol_spike</span><br/><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">long_signal</span><span class="hl-1"> ? </span><span class="hl-7">1</span><span class="hl-1"> : </span><span class="hl-4">short_signal</span><span class="hl-1"> ? -</span><span class="hl-7">1</span><span class="hl-1"> : </span><span class="hl-7">0</span><span class="hl-1">, </span><span class="hl-2">"Signal"</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-2">"Close"</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1"> * </span><span class="hl-7">0.98</span><span class="hl-1">, </span><span class="hl-2">"StopLoss"</span><span class="hl-1">) </span><span class="hl-6">// 2% stop</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1"> * </span><span class="hl-7">1.03</span><span class="hl-1">, </span><span class="hl-2">"TakeProfit"</span><span class="hl-1">) </span><span class="hl-6">// 3% target</span><br/><span class="hl-8">EOF</span>
|
| 73 |
</code><button type="button">Copy</button></pre>
|
| 74 |
|
| 75 |
<p><strong>Claude Code</strong>: <em>Running backtest on October 2025 (crypto crash period)...</em></p>
|
| 76 |
+
<pre><code class="javascript"><span class="hl-4">npm</span><span class="hl-1"> </span><span class="hl-4">start</span><span class="hl-1"> -- \</span><br/><span class="hl-1"> --</span><span class="hl-4">mode</span><span class="hl-1"> </span><span class="hl-4">backtest</span><span class="hl-1"> \</span><br/><span class="hl-1"> --</span><span class="hl-4">frame</span><span class="hl-1"> </span><span class="hl-4">October2025</span><span class="hl-1"> \</span><br/><span class="hl-1"> --</span><span class="hl-4">strategy</span><span class="hl-1"> </span><span class="hl-4">rsi</span><span class="hl-1">-</span><span class="hl-4">divergence</span><span class="hl-1"> \</span><br/><span class="hl-1"> --</span><span class="hl-4">symbol</span><span class="hl-1"> </span><span class="hl-8">BTCUSDT</span>
|
| 77 |
</code><button type="button">Copy</button></pre>
|
| 78 |
|
| 79 |
<p><em><strong>Backtest Results:</strong></em></p>
|
documents/article_04_option_hedging.html
CHANGED
|
@@ -58,15 +58,15 @@ They buy products like "protected growth": if the market rises signifi
|
|
| 58 |
<p>The key point: you need to cut backtest strategy time to zero through self-reinforcement runtime, since the bet is on temporary inefficiencies and regime adaptation.</p>
|
| 59 |
<p>The adaptive cycle has no "done" state — parameters are recalculated on each iteration for the current market regime.</p>
|
| 60 |
<p><strong>Volatility filter (GARCH):</strong></p>
|
| 61 |
-
<pre><code class="javascript"><span class="hl-
|
| 62 |
</code><button type="button">Copy</button></pre>
|
| 63 |
|
| 64 |
<p><strong>JavaScript integration:</strong></p>
|
| 65 |
-
<pre><code class="javascript"><span class="hl-4">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">addExchangeSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">addStrategySchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">addActionSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">Cache</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">Constant</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">commitPartialProfit</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">getCandles</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><br/><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">extract</span><span class="hl-1">, </span><span class="hl-5">run</span><span class="hl-1">, </span><span class="hl-5">toSignalDto</span><span class="hl-1">, </span><span class="hl-5">File</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">"@backtest-kit/pinets"</span><span class="hl-1">;</span><br/><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">predict</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">'garch'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getPlotHigher</span><span class="hl-1"> = </span><span class="hl-5">Cache</span><span class="hl-1">.</span><span class="hl-0">fn</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">run</span><span class="hl-1">(</span><span class="hl-5">File</span><span class="hl-1">.</span><span class="hl-0">fromPath</span><span class="hl-1">(</span><span class="hl-2">"timeframe_4h.pine"</span><span class="hl-1">), {</span><br/><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">timeframe:</span><span class="hl-1"> </span><span class="hl-2">"4h"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">limit:</span><span class="hl-1"> </span><span class="hl-7">100</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-5">interval:</span><span class="hl-1"> </span><span class="hl-2">"4h"</span><span class="hl-1">, </span><span class="hl-0">key</span><span class="hl-5">:</span><span class="hl-1"> ([</span><span class="hl-5">symbol</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1"> },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">getDataHigher</span><span class="hl-1"> = </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">plots</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getPlotHigher</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-5">plots</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">allowLong:</span><span class="hl-1"> </span><span class="hl-2">"AllowLong"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">allowShort:</span><span class="hl-1"> </span><span class="hl-2">"AllowShort"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">allowBoth:</span><span class="hl-1"> </span><span class="hl-2">"AllowBoth"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">noTrades:</span><span class="hl-1"> </span><span class="hl-2">"NoTrades"</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getPlotLower</span><span class="hl-1"> = </span><span class="hl-5">Cache</span><span class="hl-1">.</span><span class="hl-0">fn</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">run</span><span class="hl-1">(</span><span class="hl-5">File</span><span class="hl-1">.</span><span class="hl-0">fromPath</span><span class="hl-1">(</span><span class="hl-2">"timeframe_15m.pine"</span><span class="hl-1">), {</span><br/><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">timeframe:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">limit:</span><span class="hl-1"> </span><span class="hl-7">100</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">interval:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">key</span><span class="hl-5">:</span><span class="hl-1"> ([</span><span class="hl-5">symbol</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-2">`</span><span class="hl-3">${</span><span class="hl-5">symbol</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">getDataLower</span><span class="hl-1"> = </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">plots</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getPlotLower</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-5">plots</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">position:</span><span class="hl-1"> </span><span class="hl-2">"Signal"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">priceOpen:</span><span class="hl-1"> </span><span class="hl-2">"Close"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">priceTakeProfit:</span><span class="hl-1"> </span><span class="hl-2">"TakeProfit"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">priceStopLoss:</span><span class="hl-1"> </span><span class="hl-2">"StopLoss"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">minuteEstimatedTime:</span><span class="hl-1"> </span><span class="hl-2">"EstimatedTime"</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-0">addStrategySchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"main_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">interval:</span><span class="hl-1"> </span><span class="hl-2">"5m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getSignal</span><span class="hl-5">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data_higher</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getDataHigher</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">data_higher</span><span class="hl-1">.</span><span class="hl-5">noTrades</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">; </span><span class="hl-6">// ADX < 25, sideways market</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data_lower</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getDataLower</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">data_lower</span><span class="hl-1">.</span><span class="hl-5">position</span><span class="hl-1"> === </span><span class="hl-7">0</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">; </span><span class="hl-6">// no signal</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-6">// Filter: don't enter against the higher timeframe</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">data_higher</span><span class="hl-1">.</span><span class="hl-5">allowShort</span><span class="hl-1"> && </span><span class="hl-5">data_lower</span><span class="hl-1">.</span><span class="hl-5">position</span><span class="hl-1"> === </span><span class="hl-7">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">data_higher</span><span class="hl-1">.</span><span class="hl-5">allowLong</span><span class="hl-1"> && </span><span class="hl-5">data_lower</span><span class="hl-1">.</span><span class="hl-5">position</span><span class="hl-1"> === -</span><span class="hl-7">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-8">upperPrice</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-8">lowerPrice</span><br/><span class="hl-1"> } = </span><span class="hl-0">predict</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-2">'15m'</span><span class="hl-1">, </span><span class="hl-7">300</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-2">'15m'</span><br/><span class="hl-1"> );</span><br/><br/><span class="hl-1"> </span><span class="hl-6">// Long: TP = upperPrice, SL = lowerPrice</span><br/><span class="hl-1"> </span><span class="hl-6">// Short: TP = lowerPrice, SL = upperPrice</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">isLong</span><span class="hl-1"> = </span><span class="hl-5">data_lower</span><span class="hl-1">.</span><span class="hl-5">position</span><span class="hl-1"> === </span><span class="hl-7">1</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tp</span><span class="hl-1"> = </span><span class="hl-5">isLong</span><span class="hl-1"> ? </span><span class="hl-5">upperPrice</span><span class="hl-1"> : </span><span class="hl-5">lowerPrice</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">sl</span><span class="hl-1"> = </span><span class="hl-5">isLong</span><span class="hl-1"> ? </span><span class="hl-5">lowerPrice</span><span class="hl-1"> : </span><span class="hl-5">upperPrice</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">signal</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">toSignalDto</span><span class="hl-1">(</span><span class="hl-5">signalId</span><span class="hl-1">, </span><span class="hl-5">data_lower</span><span class="hl-1">, </span><span class="hl-3">null</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-5">Object</span><span class="hl-1">.</span><span class="hl-0">assign</span><span class="hl-1">(</span><span class="hl-5">signal</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">priceTakeProfit:</span><span class="hl-1"> </span><span class="hl-5">tp</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">priceStopLoss:</span><span class="hl-1"> </span><span class="hl-5">sl</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-5">signal</span><span class="hl-1">;</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
|
| 66 |
</code><button type="button">Copy</button></pre>
|
| 67 |
|
| 68 |
<p><strong>Position management:</strong></p>
|
| 69 |
-
<pre><code class="javascript"><span class="hl-0">addActionSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-
|
| 70 |
</code><button type="button">Copy</button></pre>
|
| 71 |
|
| 72 |
<p>Staged exit: 33% at each TP level. This locks in profit before a reversal. After breakeven — tighten the SL to protect accumulated gains.</p>
|
|
|
|
| 58 |
<p>The key point: you need to cut backtest strategy time to zero through self-reinforcement runtime, since the bet is on temporary inefficiencies and regime adaptation.</p>
|
| 59 |
<p>The adaptive cycle has no "done" state — parameters are recalculated on each iteration for the current market regime.</p>
|
| 60 |
<p><strong>Volatility filter (GARCH):</strong></p>
|
| 61 |
+
<pre><code class="javascript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">predict</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">'garch'</span><span class="hl-1">; </span><span class="hl-6">// https://www.npmjs.com/package/garch</span><br/><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">getCandles</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">'backtest-kit'</span><span class="hl-1">; </span><span class="hl-6">// https://www.npmjs.com/package/backtest-kit</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">candles</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-2">'15m'</span><span class="hl-1">, </span><span class="hl-7">300</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-8">sigma</span><span class="hl-1">, </span><span class="hl-8">reliable</span><span class="hl-1">, </span><span class="hl-8">upperPrice</span><span class="hl-1">, </span><span class="hl-8">lowerPrice</span><span class="hl-1"> } = </span><span class="hl-0">predict</span><span class="hl-1">(</span><span class="hl-4">candles</span><span class="hl-1">, </span><span class="hl-2">'15m'</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// sigma - expected price movement (0.012 = 1.2%)</span><br/><span class="hl-6">// reliable - whether the model converged</span><br/><span class="hl-6">// upperPrice / lowerPrice - +-1 sigma corridor for the next candle</span><br/><br/><span class="hl-5">if</span><span class="hl-1"> (!</span><span class="hl-4">reliable</span><span class="hl-1">) </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">; </span><span class="hl-6">// model doesn't fit the data</span><br/><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">sigma</span><span class="hl-1"> < </span><span class="hl-7">0.01</span><span class="hl-1">) </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">; </span><span class="hl-6">// movement < 1%, won't cover fees and slippage</span><br/><br/><span class="hl-6">// use upperPrice and lowerPrice as TP/SL</span><br/><span class="hl-5">return</span><span class="hl-1"> { </span><span class="hl-4">upperPrice</span><span class="hl-1">, </span><span class="hl-4">lowerPrice</span><span class="hl-1"> }</span>
|
| 62 |
</code><button type="button">Copy</button></pre>
|
| 63 |
|
| 64 |
<p><strong>JavaScript integration:</strong></p>
|
| 65 |
+
<pre><code class="javascript"><span class="hl-5">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">addExchangeSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">addStrategySchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">addActionSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">Cache</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">Constant</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">commitPartialProfit</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">getCandles</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><br/><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">extract</span><span class="hl-1">, </span><span class="hl-4">run</span><span class="hl-1">, </span><span class="hl-4">toSignalDto</span><span class="hl-1">, </span><span class="hl-4">File</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"@backtest-kit/pinets"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">predict</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">'garch'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getPlotHigher</span><span class="hl-1"> = </span><span class="hl-4">Cache</span><span class="hl-1">.</span><span class="hl-0">fn</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">run</span><span class="hl-1">(</span><span class="hl-4">File</span><span class="hl-1">.</span><span class="hl-0">fromPath</span><span class="hl-1">(</span><span class="hl-2">"timeframe_4h.pine"</span><span class="hl-1">), {</span><br/><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">timeframe:</span><span class="hl-1"> </span><span class="hl-2">"4h"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">limit:</span><span class="hl-1"> </span><span class="hl-7">100</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"4h"</span><span class="hl-1">, </span><span class="hl-0">key</span><span class="hl-4">:</span><span class="hl-1"> ([</span><span class="hl-4">symbol</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1"> },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">getDataHigher</span><span class="hl-1"> = </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">plots</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPlotHigher</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-4">plots</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">allowLong:</span><span class="hl-1"> </span><span class="hl-2">"AllowLong"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">allowShort:</span><span class="hl-1"> </span><span class="hl-2">"AllowShort"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">allowBoth:</span><span class="hl-1"> </span><span class="hl-2">"AllowBoth"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">noTrades:</span><span class="hl-1"> </span><span class="hl-2">"NoTrades"</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getPlotLower</span><span class="hl-1"> = </span><span class="hl-4">Cache</span><span class="hl-1">.</span><span class="hl-0">fn</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">run</span><span class="hl-1">(</span><span class="hl-4">File</span><span class="hl-1">.</span><span class="hl-0">fromPath</span><span class="hl-1">(</span><span class="hl-2">"timeframe_15m.pine"</span><span class="hl-1">), {</span><br/><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">timeframe:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">limit:</span><span class="hl-1"> </span><span class="hl-7">100</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">key</span><span class="hl-4">:</span><span class="hl-1"> ([</span><span class="hl-4">symbol</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-2">`</span><span class="hl-3">${</span><span class="hl-4">symbol</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">getDataLower</span><span class="hl-1"> = </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">plots</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPlotLower</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-4">plots</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">position:</span><span class="hl-1"> </span><span class="hl-2">"Signal"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priceOpen:</span><span class="hl-1"> </span><span class="hl-2">"Close"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priceTakeProfit:</span><span class="hl-1"> </span><span class="hl-2">"TakeProfit"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priceStopLoss:</span><span class="hl-1"> </span><span class="hl-2">"StopLoss"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">minuteEstimatedTime:</span><span class="hl-1"> </span><span class="hl-2">"EstimatedTime"</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-0">addStrategySchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"main_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"5m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getSignal</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data_higher</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getDataHigher</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_higher</span><span class="hl-1">.</span><span class="hl-4">noTrades</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">; </span><span class="hl-6">// ADX < 25, sideways market</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">data_lower</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getDataLower</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_lower</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === </span><span class="hl-7">0</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">; </span><span class="hl-6">// no signal</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-6">// Filter: don't enter against the higher timeframe</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_higher</span><span class="hl-1">.</span><span class="hl-4">allowShort</span><span class="hl-1"> && </span><span class="hl-4">data_lower</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === </span><span class="hl-7">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">data_higher</span><span class="hl-1">.</span><span class="hl-4">allowLong</span><span class="hl-1"> && </span><span class="hl-4">data_lower</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === -</span><span class="hl-7">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-8">upperPrice</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-8">lowerPrice</span><br/><span class="hl-1"> } = </span><span class="hl-0">predict</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-2">'15m'</span><span class="hl-1">, </span><span class="hl-7">300</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-2">'15m'</span><br/><span class="hl-1"> );</span><br/><br/><span class="hl-1"> </span><span class="hl-6">// Long: TP = upperPrice, SL = lowerPrice</span><br/><span class="hl-1"> </span><span class="hl-6">// Short: TP = lowerPrice, SL = upperPrice</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">isLong</span><span class="hl-1"> = </span><span class="hl-4">data_lower</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === </span><span class="hl-7">1</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tp</span><span class="hl-1"> = </span><span class="hl-4">isLong</span><span class="hl-1"> ? </span><span class="hl-4">upperPrice</span><span class="hl-1"> : </span><span class="hl-4">lowerPrice</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">sl</span><span class="hl-1"> = </span><span class="hl-4">isLong</span><span class="hl-1"> ? </span><span class="hl-4">lowerPrice</span><span class="hl-1"> : </span><span class="hl-4">upperPrice</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">signal</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">toSignalDto</span><span class="hl-1">(</span><span class="hl-4">signalId</span><span class="hl-1">, </span><span class="hl-4">data_lower</span><span class="hl-1">, </span><span class="hl-3">null</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-4">Object</span><span class="hl-1">.</span><span class="hl-0">assign</span><span class="hl-1">(</span><span class="hl-4">signal</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">priceTakeProfit:</span><span class="hl-1"> </span><span class="hl-4">tp</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priceStopLoss:</span><span class="hl-1"> </span><span class="hl-4">sl</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">signal</span><span class="hl-1">;</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
|
| 66 |
</code><button type="button">Copy</button></pre>
|
| 67 |
|
| 68 |
<p><strong>Position management:</strong></p>
|
| 69 |
+
<pre><code class="javascript"><span class="hl-0">addActionSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">actionName:</span><span class="hl-1"> </span><span class="hl-2">"partial_profit_action"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">handler:</span><span class="hl-1"> </span><span class="hl-3">class</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-0">partialProfitAvailable</span><span class="hl-1">({ </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">level</span><span class="hl-1"> }) {</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">level</span><span class="hl-1"> === </span><span class="hl-4">Constant</span><span class="hl-1">.</span><span class="hl-8">TP_LEVEL3</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitPartialProfit</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-7">33</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">level</span><span class="hl-1"> === </span><span class="hl-4">Constant</span><span class="hl-1">.</span><span class="hl-8">TP_LEVEL2</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitPartialProfit</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-7">33</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">level</span><span class="hl-1"> === </span><span class="hl-4">Constant</span><span class="hl-1">.</span><span class="hl-8">TP_LEVEL1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitPartialProfit</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-7">34</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">addActionSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">actionName:</span><span class="hl-1"> </span><span class="hl-2">"breakeven_action"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">handler:</span><span class="hl-1"> </span><span class="hl-3">class</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-0">breakevenAvailable</span><span class="hl-1">({ </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">currentPrice</span><span class="hl-1"> }) {</span><br/><span class="hl-1"> </span><span class="hl-6">// Tighten trailing stop after breakeven</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitTrailingStop</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, -</span><span class="hl-7">3</span><span class="hl-1">, </span><span class="hl-4">currentPrice</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span>
|
| 70 |
</code><button type="button">Copy</button></pre>
|
| 71 |
|
| 72 |
<p>Staged exit: 33% at each TP level. This locks in profit before a reversal. After breakeven — tighten the SL to protect accumulated gains.</p>
|
documents/article_05_ai_strategy_workflow.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
<p>A liquidation cascade is not random price movement. The price drops below a certain level and the exchange forcibly closes positions — via market orders, selling everything at once without discrimination. The price drops fast and deep within one or two bars, after which there is no one left to sell and the market bounces back. This pattern repeats dozens of times a year.</p>
|
| 7 |
<p>Yet nobody profits from it, because the parameters change every month. In one regime a cascade is a support level breakdown with continuation downward. In another it's a spike with an immediate V-bounce of 3%. Updating these criteria requires digging into the news feed: who got liquidated and why. <a href="article_03_claude_trader.html">This makes building such a system by hand impractical.</a></p>
|
| 8 |
<a id="what-changed" class="tsd-anchor"></a><h2 class="tsd-anchor-link">What Changed<a href="#what-changed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>In March 2026, Anthropic added the <code>/loop</code> command to Claude Code — a local scheduler (crontab) that runs a prompt in the background while the session is open. This closes the loop:</p>
|
| 9 |
-
<pre><code><span class="hl-
|
| 10 |
</code><button>Copy</button></pre>
|
| 11 |
|
| 12 |
<p>However, writing the command literally won't work. There are at least two reasons: your inability to articulate the requirement lets Anthropic profit from you. And second — you have no acceptance criteria to validate the strategy on historical data before deploying to production.</p>
|
|
@@ -213,13 +213,13 @@ If it is impossible to make money, do not try to fudge the results. Write it as
|
|
| 213 |
<a id="source-code" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Source Code<a href="#source-code" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><blockquote>
|
| 214 |
<p>feb_2026.strategy.ts</p>
|
| 215 |
</blockquote>
|
| 216 |
-
<pre><code class="typescript"><span class="hl-4">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">addExchangeSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">addFrameSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">addStrategySchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">listenError</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">Cache</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">Log</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><span class="hl-4">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">errorData</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">getErrorMessage</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">randomString</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">singleshot</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">"functools-kit"</span><span class="hl-1">;</span><br/><span class="hl-4">import</span><span class="hl-1"> </span><span class="hl-5">ccxt</span><span class="hl-1"> </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">"ccxt"</span><span class="hl-1">;</span><br/><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">run</span><span class="hl-1">, </span><span class="hl-5">File</span><span class="hl-1">, </span><span class="hl-5">extract</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">"@backtest-kit/pinets"</span><span class="hl-1">;</span><br/><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">outputNode</span><span class="hl-1">, </span><span class="hl-5">resolve</span><span class="hl-1">, </span><span class="hl-5">sourceNode</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">"@backtest-kit/graph"</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getExchange</span><span class="hl-1"> = </span><span class="hl-0">singleshot</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-5">ccxt</span><span class="hl-1">.</span><span class="hl-0">binance</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">options:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">defaultType:</span><span class="hl-1"> </span><span class="hl-2">"spot"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">adjustForTimeDifference:</span><span class="hl-1"> </span><span class="hl-3">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">recvWindow:</span><span class="hl-1"> </span><span class="hl-7">60000</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-5">enableRateLimit:</span><span class="hl-1"> </span><span class="hl-3">true</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-5">exchange</span><span class="hl-1">.</span><span class="hl-0">loadMarkets</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-5">exchange</span><span class="hl-1">;</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">pineSource</span><span class="hl-1"> = </span><span class="hl-0">sourceNode</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-5">Cache</span><span class="hl-1">.</span><span class="hl-0">fn</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">plots</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">run</span><span class="hl-1">(</span><span class="hl-5">File</span><span class="hl-1">.</span><span class="hl-0">fromPath</span><span class="hl-1">(</span><span class="hl-2">"feb_2026.pine"</span><span class="hl-1">, </span><span class="hl-2">"../math"</span><span class="hl-1">), {</span><br/><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">timeframe:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">limit:</span><span class="hl-1"> </span><span class="hl-7">2688</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-5">plots</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">position:</span><span class="hl-1"> </span><span class="hl-2">"Position"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">entryPrice:</span><span class="hl-1"> </span><span class="hl-2">"EntryPrice"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">tp:</span><span class="hl-1"> </span><span class="hl-2">"TP"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">sl:</span><span class="hl-1"> </span><span class="hl-2">"SL"</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-5">interval:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">, </span><span class="hl-0">key</span><span class="hl-5">:</span><span class="hl-1"> ([</span><span class="hl-5">symbol</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1"> },</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">signalOutput</span><span class="hl-1"> = </span><span class="hl-0">outputNode</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ([</span><span class="hl-5">pineSource</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">position</span><span class="hl-1"> =</span><br/><span class="hl-1"> </span><span class="hl-5">pineSource</span><span class="hl-1">.</span><span class="hl-5">position</span><span class="hl-1"> === -</span><span class="hl-7">1</span><br/><span class="hl-1"> ? </span><span class="hl-2">"short"</span><br/><span class="hl-1"> : </span><span class="hl-5">pineSource</span><span class="hl-1">.</span><span class="hl-5">position</span><span class="hl-1"> === </span><span class="hl-7">1</span><br/><span class="hl-1"> ? </span><span class="hl-2">"long"</span><br/><span class="hl-1"> : </span><span class="hl-2">"wait"</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">position</span><span class="hl-1"> === </span><span class="hl-2">"wait"</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">id:</span><span class="hl-1"> </span><span class="hl-0">randomString</span><span class="hl-1">(),</span><br/><span class="hl-1"> </span><span class="hl-5">position</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">priceOpen:</span><span class="hl-1"> </span><span class="hl-5">pineSource</span><span class="hl-1">.</span><span class="hl-5">entryPrice</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">priceTakeProfit:</span><span class="hl-1"> </span><span class="hl-5">pineSource</span><span class="hl-1">.</span><span class="hl-5">tp</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">priceStopLoss:</span><span class="hl-1"> </span><span class="hl-5">pineSource</span><span class="hl-1">.</span><span class="hl-5">sl</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">minuteEstimatedTime:</span><span class="hl-1"> </span><span class="hl-3">Infinity</span><span class="hl-1">,</span><br/><span class="hl-1"> } </span><span class="hl-4">as</span><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1">;</span><br/><span class="hl-1">}, </span><span class="hl-5">pineSource</span><span class="hl-1">);</span><br/><br/><span class="hl-0">addExchangeSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"ccxt-exchange"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-5">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-5">interval</span><span class="hl-1">, </span><span class="hl-5">since</span><span class="hl-1">, </span><span class="hl-5">limit</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getExchange</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">candles</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-5">exchange</span><span class="hl-1">.</span><span class="hl-0">fetchOHLCV</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">interval</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">since</span><span class="hl-1">.</span><span class="hl-0">getTime</span><span class="hl-1">(),</span><br/><span class="hl-1"> </span><span class="hl-5">limit</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-5">candles</span><span class="hl-1">.</span><span class="hl-0">map</span><span class="hl-1">(([</span><span class="hl-5">timestamp</span><span class="hl-1">, </span><span class="hl-5">open</span><span class="hl-1">, </span><span class="hl-5">high</span><span class="hl-1">, </span><span class="hl-5">low</span><span class="hl-1">, </span><span class="hl-5">close</span><span class="hl-1">, </span><span class="hl-5">volume</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> ({</span><br/><span class="hl-1"> </span><span class="hl-5">timestamp</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">open</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">high</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">low</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">close</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">volume</span><span class="hl-1">,</span><br/><span class="hl-1"> }));</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">addFrameSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">frameName:</span><span class="hl-1"> </span><span class="hl-2">"feb_2026_frame"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">interval:</span><span class="hl-1"> </span><span class="hl-2">"1m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">startDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2026-02-01T00:00:00Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-5">endDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2026-02-28T23:59:59Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-5">note:</span><span class="hl-1"> </span><span class="hl-2">"February 2026"</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">addStrategySchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"feb_2026_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">interval:</span><span class="hl-1"> </span><span class="hl-2">"1m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getSignal</span><span class="hl-5">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">resolve</span><span class="hl-1">(</span><span class="hl-5">signalOutput</span><span class="hl-1">),</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">listenError</span><span class="hl-1">((</span><span class="hl-5">error</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">Log</span><span class="hl-1">.</span><span class="hl-0">debug</span><span class="hl-1">(</span><span class="hl-2">"error"</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">error:</span><span class="hl-1"> </span><span class="hl-0">errorData</span><span class="hl-1">(</span><span class="hl-5">error</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-5">message:</span><span class="hl-1"> </span><span class="hl-0">getErrorMessage</span><span class="hl-1">(</span><span class="hl-5">error</span><span class="hl-1">),</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">});</span>
|
| 217 |
</code><button type="button">Copy</button></pre>
|
| 218 |
|
| 219 |
<blockquote>
|
| 220 |
<p>feb_2026.pine</p>
|
| 221 |
</blockquote>
|
| 222 |
-
<pre><code class="javascript"><span class="hl-6">//@version=5</span><br/><span class="hl-6">// ============================================================</span><br/><span class="hl-6">// feb_2026.pine — LiquidationSpike Bounce LONG | BTCUSDT 15m</span><br/><span class="hl-6">// Test period: 2026-02-01 — 2026-02-28</span><br/><span class="hl-6">// ============================================================</span><br/><span class="hl-6">// Market context February 2026:</span><br/><span class="hl-6">// BTC: 78K → 60K (crash Feb 5, -17% in 1 day) → bounce 70K → down again to 62K (Feb 23)</span><br/><span class="hl-6">// Structure: hard bear trend with liquidation cascades and V-bounces.</span><br/><span class="hl-6">// Drivers: Trump tariffs, ETF outflows -$3.8B, $2.56B in liquidations in 1 day.</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Trade idea (Liquidation Spike Bounce):</span><br/><span class="hl-6">// After a liquidation cascade (abnormal volume + large single-bar drop),</span><br/><span class="hl-6">// the market produces a V-bounce of 1.5-4% within 1-8 bars. Enter on the first reversal candle.</span><br/><span class="hl-6">// Cooldown: ignore new signals for 20 bars after the previous entry.</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Entry conditions:</span><br/><span class="hl-6">// 1. Bear context: close < EMA50</span><br/><span class="hl-6">// 2. Spike[1]: (open[1]-close[1]) > 2.0*ATR14 AND drop > 0.6% of price (liquidation candle)</span><br/><span class="hl-6">// 3. Volume[1] > 1.8 * SMA(volume,20)</span><br/><span class="hl-6">// 4. Bounce bar: close > open AND close > low[1]</span><br/><span class="hl-6">// 5. Cooldown: barsSinceRaw >= 20 (no more than one entry per 5h)</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Exits (strictly fixed, no trailing):</span><br/><span class="hl-6">// TP: +1.5% from entryPrice</span><br/><span class="hl-6">// SL: -0.8% from entryPrice</span><br/><span class="hl-6">// RSI exit: rsi > 60 (momentum exhausted)</span><br/><span class="hl-6">// Time exit: 20 bars (5 hours)</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Risk/Reward: 1.875 | Commission: 0.4% round trip</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// BACKTEST RESULTS 2026-02-01 — 2026-02-28:</span><br/><span class="hl-6">// Trades: 3 (~1 trade every 9 days)</span><br/><span class="hl-6">// WinRate: 100% (3W / 0L)</span><br/><span class="hl-6">// Gross PnL: +5.34%</span><br/><span class="hl-6">// Net PnL (−0.4% commission × 3): +4.14%</span><br/><span class="hl-6">// AvgPnL: +1.78% per trade</span><br/><span class="hl-6">// sharpeRatio: N/A (0 losses, StdDev not applicable)</span><br/><span class="hl-6">// Trades:</span><br/><span class="hl-6">// 02-06 00:15 LONG ep=61373 exit=62966 +2.59% (V-bounce after $60K flash crash)</span><br/><span class="hl-6">// 02-10 14:45 LONG ep=68460 exit=69287 +1.21% (bounce after liquidation cascade)</span><br/><span class="hl-6">// 02-23 02:00 LONG ep=64763 exit=65762 +1.54% (bounce after tariff shock crash)</span><br/><span class="hl-6">// Note: strategy stays flat during quiet periods (Feb 11-22, Feb 24-28) —</span><br/><span class="hl-6">// this is intentional; no edge in ranging markets.</span><br/><span class="hl-6">// ============================================================</span><br/><br/><span class="hl-0">indicator</span><span class="hl-1">(</span><span class="hl-2">"LiqSpikeBounceLong Feb2026"</span><span class="hl-1">, </span><span class="hl-5">overlay</span><span class="hl-1">=</span><span class="hl-3">true</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Inputs ---</span><br/><span class="hl-5">emaLen</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">50</span><span class="hl-1">, </span><span class="hl-2">"EMA Bear Filter"</span><span class="hl-1">)</span><br/><span class="hl-5">atrLen</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">14</span><span class="hl-1">, </span><span class="hl-2">"ATR Period"</span><span class="hl-1">)</span><br/><span class="hl-5">spikeMul</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">2.0</span><span class="hl-1">,</span><span class="hl-2">"Spike ATR Multiplier"</span><span class="hl-1">)</span><br/><span class="hl-5">volLen</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">20</span><span class="hl-1">, </span><span class="hl-2">"Volume Avg Period"</span><span class="hl-1">)</span><br/><span class="hl-5">volMul</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">1.8</span><span class="hl-1">,</span><span class="hl-2">"Volume Spike Multiplier"</span><span class="hl-1">)</span><br/><span class="hl-5">rsiLen</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">14</span><span class="hl-1">, </span><span class="hl-2">"RSI Period"</span><span class="hl-1">)</span><br/><span class="hl-5">rsiExit</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">60</span><span class="hl-1">, </span><span class="hl-2">"RSI Exit Level"</span><span class="hl-1">)</span><br/><span class="hl-5">maxBars</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">20</span><span class="hl-1">, </span><span class="hl-2">"Max Hold Bars (5h)"</span><span class="hl-1">)</span><br/><span class="hl-5">cooldown</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">20</span><span class="hl-1">, </span><span class="hl-2">"Cooldown Bars Between Entries"</span><span class="hl-1">)</span><br/><span class="hl-5">tpPct</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">1.5</span><span class="hl-1">,</span><span class="hl-2">"TP %"</span><span class="hl-1">) / </span><span class="hl-7">100</span><br/><span class="hl-5">slPct</span><span class="hl-1"> = </span><span class="hl-5">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">0.8</span><span class="hl-1">,</span><span class="hl-2">"SL %"</span><span class="hl-1">) / </span><span class="hl-7">100</span><br/><br/><span class="hl-6">// --- Indicators ---</span><br/><span class="hl-5">ema50</span><span class="hl-1"> = </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">ema</span><span class="hl-1">(</span><span class="hl-5">close</span><span class="hl-1">, </span><span class="hl-5">emaLen</span><span class="hl-1">)</span><br/><span class="hl-5">atr14</span><span class="hl-1"> = </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">atr</span><span class="hl-1">(</span><span class="hl-5">atrLen</span><span class="hl-1">)</span><br/><span class="hl-5">avgVol</span><span class="hl-1"> = </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">sma</span><span class="hl-1">(</span><span class="hl-5">volume</span><span class="hl-1">, </span><span class="hl-5">volLen</span><span class="hl-1">)</span><br/><span class="hl-5">rsi</span><span class="hl-1"> = </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">rsi</span><span class="hl-1">(</span><span class="hl-5">close</span><span class="hl-1">, </span><span class="hl-5">rsiLen</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Signal conditions ---</span><br/><span class="hl-5">bearFilter</span><span class="hl-1"> = </span><span class="hl-5">close</span><span class="hl-1"> < </span><span class="hl-5">ema50</span><br/><br/><span class="hl-6">// Spike bar: must exceed ATR multiplier AND be at least 0.6% of price in absolute terms.</span><br/><span class="hl-6">// The 0.6% floor filters out false spikes during ultra-low-volatility periods</span><br/><span class="hl-6">// where even a $200 drop can exceed 2×ATR (ATR collapses in quiet markets).</span><br/><span class="hl-5">spikeDrop</span><span class="hl-1"> = </span><span class="hl-5">open</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] - </span><span class="hl-5">close</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">]</span><br/><span class="hl-5">spikeBar</span><span class="hl-1"> = </span><span class="hl-5">spikeDrop</span><span class="hl-1"> > </span><span class="hl-5">spikeMul</span><span class="hl-1"> * </span><span class="hl-5">atr14</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">close</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] < </span><span class="hl-5">open</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">]</span><br/><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">spikeDrop</span><span class="hl-1"> > </span><span class="hl-5">close</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] * </span><span class="hl-7">0.006</span><br/><br/><span class="hl-5">volSpike</span><span class="hl-1"> = </span><span class="hl-5">volume</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] > </span><span class="hl-5">volMul</span><span class="hl-1"> * </span><span class="hl-5">avgVol</span><br/><span class="hl-5">bounceBar</span><span class="hl-1"> = </span><span class="hl-5">close</span><span class="hl-1"> > </span><span class="hl-5">open</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">close</span><span class="hl-1"> > </span><span class="hl-5">low</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">]</span><br/><br/><span class="hl-5">rawSignal</span><span class="hl-1"> = </span><span class="hl-5">bearFilter</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">spikeBar</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">volSpike</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">bounceBar</span><br/><br/><span class="hl-6">// Cooldown через rawSignal[1]: сколько баров прошло с предыдущего rawSignal</span><br/><span class="hl-5">barsSinceRaw</span><span class="hl-1"> = </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">barssince</span><span class="hl-1">(</span><span class="hl-5">rawSignal</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">])</span><br/><br/><span class="hl-6">// Входим только если последний сигнал был давно (cooldown)</span><br/><span class="hl-5">longEntry</span><span class="hl-1"> = </span><span class="hl-5">rawSignal</span><span class="hl-1"> </span><span class="hl-0">and</span><span class="hl-1"> (</span><span class="hl-0">na</span><span class="hl-1">(</span><span class="hl-5">barsSinceRaw</span><span class="hl-1">) </span><span class="hl-5">or</span><span class="hl-1"> </span><span class="hl-5">barsSinceRaw</span><span class="hl-1"> >= </span><span class="hl-5">cooldown</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Position tracking ---</span><br/><span class="hl-5">barsSinceEntry</span><span class="hl-1"> = </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">barssince</span><span class="hl-1">(</span><span class="hl-5">longEntry</span><span class="hl-1">)</span><br/><br/><span class="hl-5">entryPrice</span><span class="hl-1"> = </span><span class="hl-5">longEntry</span><span class="hl-1"> ? </span><span class="hl-5">close</span><span class="hl-1"> : </span><span class="hl-5">close</span><span class="hl-1">[</span><span class="hl-5">barsSinceEntry</span><span class="hl-1">]</span><br/><span class="hl-5">entryTP</span><span class="hl-1"> = </span><span class="hl-5">entryPrice</span><span class="hl-1"> * (</span><span class="hl-7">1</span><span class="hl-1"> + </span><span class="hl-5">tpPct</span><span class="hl-1">)</span><br/><span class="hl-5">entrySL</span><span class="hl-1"> = </span><span class="hl-5">entryPrice</span><span class="hl-1"> * (</span><span class="hl-7">1</span><span class="hl-1"> - </span><span class="hl-5">slPct</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Exit Conditions ---</span><br/><span class="hl-6">// Use high/low (wick prices) to match real exchange fill behaviour.</span><br/><span class="hl-6">// barsSinceEntry > 0 guard: skip the entry bar itself — entry is at close,</span><br/><span class="hl-6">// so the entry bar's own wick must not trigger an immediate exit.</span><br/><span class="hl-5">hitTP</span><span class="hl-1"> = </span><span class="hl-5">barsSinceEntry</span><span class="hl-1"> > </span><span class="hl-7">0</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">highest</span><span class="hl-1">(</span><span class="hl-5">high</span><span class="hl-1">, </span><span class="hl-5">barsSinceEntry</span><span class="hl-1">) >= </span><span class="hl-5">entryTP</span><br/><span class="hl-5">hitSL</span><span class="hl-1"> = </span><span class="hl-5">barsSinceEntry</span><span class="hl-1"> > </span><span class="hl-7">0</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">ta</span><span class="hl-1">.</span><span class="hl-0">lowest</span><span class="hl-1">(</span><span class="hl-5">low</span><span class="hl-1">, </span><span class="hl-5">barsSinceEntry</span><span class="hl-1">) <= </span><span class="hl-5">entrySL</span><br/><span class="hl-5">rsiDone</span><span class="hl-1"> = </span><span class="hl-5">rsi</span><span class="hl-1"> > </span><span class="hl-5">rsiExit</span><br/><span class="hl-5">timeLimit</span><span class="hl-1"> = </span><span class="hl-5">barsSinceEntry</span><span class="hl-1"> >= </span><span class="hl-5">maxBars</span><br/><br/><span class="hl-5">inPosition</span><span class="hl-1"> = </span><span class="hl-5">not</span><span class="hl-1"> </span><span class="hl-0">na</span><span class="hl-1">(</span><span class="hl-5">barsSinceEntry</span><span class="hl-1">) </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">not</span><span class="hl-1"> </span><span class="hl-5">hitTP</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">not</span><span class="hl-1"> </span><span class="hl-5">hitSL</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">not</span><span class="hl-1"> </span><span class="hl-5">rsiDone</span><span class="hl-1"> </span><span class="hl-5">and</span><span class="hl-1"> </span><span class="hl-5">not</span><span class="hl-1"> </span><span class="hl-5">timeLimit</span><br/><br/><span class="hl-5">position</span><span class="hl-1"> = </span><span class="hl-5">inPosition</span><span class="hl-1"> ? </span><span class="hl-7">1</span><span class="hl-1"> : </span><span class="hl-7">0</span><br/><br/><span class="hl-6">// === OUTPUTS FOR BOT ===</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">position</span><span class="hl-1">, </span><span class="hl-2">"Position"</span><span class="hl-1">, </span><span class="hl-5">display</span><span class="hl-1">=</span><span class="hl-5">display</span><span class="hl-1">.</span><span class="hl-5">data_window</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-5">entryTP</span><span class="hl-1"> : </span><span class="hl-5">na</span><span class="hl-1">, </span><span class="hl-2">"TP"</span><span class="hl-1">, </span><span class="hl-5">display</span><span class="hl-1">=</span><span class="hl-5">display</span><span class="hl-1">.</span><span class="hl-5">data_window</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-5">entrySL</span><span class="hl-1"> : </span><span class="hl-5">na</span><span class="hl-1">, </span><span class="hl-2">"SL"</span><span class="hl-1">, </span><span class="hl-5">display</span><span class="hl-1">=</span><span class="hl-5">display</span><span class="hl-1">.</span><span class="hl-5">data_window</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-5">entryPrice</span><span class="hl-1"> : </span><span class="hl-5">na</span><span class="hl-1">, </span><span class="hl-2">"EntryPrice"</span><span class="hl-1">, </span><span class="hl-5">display</span><span class="hl-1">=</span><span class="hl-5">display</span><span class="hl-1">.</span><span class="hl-5">data_window</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// === VISUAL ===</span><br/><span class="hl-5">lineColor</span><span class="hl-1"> = </span><span class="hl-5">position</span><span class="hl-1"> == </span><span class="hl-7">0</span><span class="hl-1"> ? </span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-5">gray</span><span class="hl-1"> : </span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-5">green</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">close</span><span class="hl-1">, </span><span class="hl-2">"Price"</span><span class="hl-1">, </span><span class="hl-5">color</span><span class="hl-1">=</span><span class="hl-5">lineColor</span><span class="hl-1">, </span><span class="hl-5">linewidth</span><span class="hl-1">=</span><span class="hl-7">2</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">ema50</span><span class="hl-1">, </span><span class="hl-2">"EMA50"</span><span class="hl-1">, </span><span class="hl-5">color</span><span class="hl-1">=</span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-0">new</span><span class="hl-1">(</span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-5">orange</span><span class="hl-1">, </span><span class="hl-7">50</span><span class="hl-1">), </span><span class="hl-5">linewidth</span><span class="hl-1">=</span><span class="hl-7">1</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-5">entryTP</span><span class="hl-1"> : </span><span class="hl-5">na</span><span class="hl-1">, </span><span class="hl-2">"TP Line"</span><span class="hl-1">, </span><span class="hl-5">color</span><span class="hl-1">=</span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-0">new</span><span class="hl-1">(</span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-5">green</span><span class="hl-1">, </span><span class="hl-7">30</span><span class="hl-1">), </span><span class="hl-5">linewidth</span><span class="hl-1">=</span><span class="hl-7">1</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-5">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-5">entrySL</span><span class="hl-1"> : </span><span class="hl-5">na</span><span class="hl-1">, </span><span class="hl-2">"SL Line"</span><span class="hl-1">, </span><span class="hl-5">color</span><span class="hl-1">=</span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-0">new</span><span class="hl-1">(</span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-5">red</span><span class="hl-1">, </span><span class="hl-7">30</span><span class="hl-1">), </span><span class="hl-5">linewidth</span><span class="hl-1">=</span><span class="hl-7">1</span><span class="hl-1">)</span><br/><span class="hl-0">plotshape</span><span class="hl-1">(</span><span class="hl-5">longEntry</span><span class="hl-1">, </span><span class="hl-2">"Entry"</span><span class="hl-1">, </span><span class="hl-5">shape</span><span class="hl-1">.</span><span class="hl-5">triangleup</span><span class="hl-1">, </span><span class="hl-5">location</span><span class="hl-1">.</span><span class="hl-5">belowbar</span><span class="hl-1">, </span><span class="hl-5">color</span><span class="hl-1">.</span><span class="hl-5">green</span><span class="hl-1">, </span><span class="hl-5">size</span><span class="hl-1">=</span><span class="hl-5">size</span><span class="hl-1">.</span><span class="hl-5">small</span><span class="hl-1">)</span>
|
| 223 |
</code><button type="button">Copy</button></pre>
|
| 224 |
|
| 225 |
<blockquote>
|
|
|
|
| 6 |
<p>A liquidation cascade is not random price movement. The price drops below a certain level and the exchange forcibly closes positions — via market orders, selling everything at once without discrimination. The price drops fast and deep within one or two bars, after which there is no one left to sell and the market bounces back. This pattern repeats dozens of times a year.</p>
|
| 7 |
<p>Yet nobody profits from it, because the parameters change every month. In one regime a cascade is a support level breakdown with continuation downward. In another it's a spike with an immediate V-bounce of 3%. Updating these criteria requires digging into the news feed: who got liquidated and why. <a href="article_03_claude_trader.html">This makes building such a system by hand impractical.</a></p>
|
| 8 |
<a id="what-changed" class="tsd-anchor"></a><h2 class="tsd-anchor-link">What Changed<a href="#what-changed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>In March 2026, Anthropic added the <code>/loop</code> command to Claude Code — a local scheduler (crontab) that runs a prompt in the background while the session is open. This closes the loop:</p>
|
| 9 |
+
<pre><code><span class="hl-4">claude</span><span class="hl-1"> --</span><span class="hl-4">loop</span><span class="hl-1"> 1</span><span class="hl-4">d</span><span class="hl-1"> </span><span class="hl-4">create</span><span class="hl-1"> </span><span class="hl-4">trading</span><span class="hl-1"> </span><span class="hl-4">strategy</span><span class="hl-1"> </span><span class="hl-4">which</span><span class="hl-1"> </span><span class="hl-4">will</span><span class="hl-1"> </span><span class="hl-4">be</span><span class="hl-1"> </span><span class="hl-4">profitable</span>
|
| 10 |
</code><button>Copy</button></pre>
|
| 11 |
|
| 12 |
<p>However, writing the command literally won't work. There are at least two reasons: your inability to articulate the requirement lets Anthropic profit from you. And second — you have no acceptance criteria to validate the strategy on historical data before deploying to production.</p>
|
|
|
|
| 213 |
<a id="source-code" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Source Code<a href="#source-code" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><blockquote>
|
| 214 |
<p>feb_2026.strategy.ts</p>
|
| 215 |
</blockquote>
|
| 216 |
+
<pre><code class="typescript"><span class="hl-5">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">addExchangeSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">addFrameSchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">addStrategySchema</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">listenError</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">Cache</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">Log</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">errorData</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">getErrorMessage</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">randomString</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">singleshot</span><span class="hl-1">,</span><br/><span class="hl-1">} </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"functools-kit"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> </span><span class="hl-4">ccxt</span><span class="hl-1"> </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"ccxt"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">run</span><span class="hl-1">, </span><span class="hl-4">File</span><span class="hl-1">, </span><span class="hl-4">extract</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"@backtest-kit/pinets"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">outputNode</span><span class="hl-1">, </span><span class="hl-4">resolve</span><span class="hl-1">, </span><span class="hl-4">sourceNode</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"@backtest-kit/graph"</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getExchange</span><span class="hl-1"> = </span><span class="hl-0">singleshot</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-4">ccxt</span><span class="hl-1">.</span><span class="hl-0">binance</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">options:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">defaultType:</span><span class="hl-1"> </span><span class="hl-2">"spot"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">adjustForTimeDifference:</span><span class="hl-1"> </span><span class="hl-3">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">recvWindow:</span><span class="hl-1"> </span><span class="hl-7">60000</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">enableRateLimit:</span><span class="hl-1"> </span><span class="hl-3">true</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">exchange</span><span class="hl-1">.</span><span class="hl-0">loadMarkets</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">exchange</span><span class="hl-1">;</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">pineSource</span><span class="hl-1"> = </span><span class="hl-0">sourceNode</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-4">Cache</span><span class="hl-1">.</span><span class="hl-0">fn</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">plots</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">run</span><span class="hl-1">(</span><span class="hl-4">File</span><span class="hl-1">.</span><span class="hl-0">fromPath</span><span class="hl-1">(</span><span class="hl-2">"feb_2026.pine"</span><span class="hl-1">, </span><span class="hl-2">"../math"</span><span class="hl-1">), {</span><br/><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">timeframe:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">limit:</span><span class="hl-1"> </span><span class="hl-7">2688</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-4">plots</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">position:</span><span class="hl-1"> </span><span class="hl-2">"Position"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">entryPrice:</span><span class="hl-1"> </span><span class="hl-2">"EntryPrice"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">tp:</span><span class="hl-1"> </span><span class="hl-2">"TP"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">sl:</span><span class="hl-1"> </span><span class="hl-2">"SL"</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"15m"</span><span class="hl-1">, </span><span class="hl-0">key</span><span class="hl-4">:</span><span class="hl-1"> ([</span><span class="hl-4">symbol</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1"> },</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">signalOutput</span><span class="hl-1"> = </span><span class="hl-0">outputNode</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ([</span><span class="hl-4">pineSource</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">position</span><span class="hl-1"> =</span><br/><span class="hl-1"> </span><span class="hl-4">pineSource</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === -</span><span class="hl-7">1</span><br/><span class="hl-1"> ? </span><span class="hl-2">"short"</span><br/><span class="hl-1"> : </span><span class="hl-4">pineSource</span><span class="hl-1">.</span><span class="hl-4">position</span><span class="hl-1"> === </span><span class="hl-7">1</span><br/><span class="hl-1"> ? </span><span class="hl-2">"long"</span><br/><span class="hl-1"> : </span><span class="hl-2">"wait"</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">position</span><span class="hl-1"> === </span><span class="hl-2">"wait"</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-0">randomString</span><span class="hl-1">(),</span><br/><span class="hl-1"> </span><span class="hl-4">position</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priceOpen:</span><span class="hl-1"> </span><span class="hl-4">pineSource</span><span class="hl-1">.</span><span class="hl-4">entryPrice</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priceTakeProfit:</span><span class="hl-1"> </span><span class="hl-4">pineSource</span><span class="hl-1">.</span><span class="hl-4">tp</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priceStopLoss:</span><span class="hl-1"> </span><span class="hl-4">pineSource</span><span class="hl-1">.</span><span class="hl-4">sl</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">minuteEstimatedTime:</span><span class="hl-1"> </span><span class="hl-3">Infinity</span><span class="hl-1">,</span><br/><span class="hl-1"> } </span><span class="hl-5">as</span><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1">;</span><br/><span class="hl-1">}, </span><span class="hl-4">pineSource</span><span class="hl-1">);</span><br/><br/><span class="hl-0">addExchangeSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"ccxt-exchange"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">interval</span><span class="hl-1">, </span><span class="hl-4">since</span><span class="hl-1">, </span><span class="hl-4">limit</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getExchange</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">candles</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">exchange</span><span class="hl-1">.</span><span class="hl-0">fetchOHLCV</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">interval</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">since</span><span class="hl-1">.</span><span class="hl-0">getTime</span><span class="hl-1">(),</span><br/><span class="hl-1"> </span><span class="hl-4">limit</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">candles</span><span class="hl-1">.</span><span class="hl-0">map</span><span class="hl-1">(([</span><span class="hl-4">timestamp</span><span class="hl-1">, </span><span class="hl-4">open</span><span class="hl-1">, </span><span class="hl-4">high</span><span class="hl-1">, </span><span class="hl-4">low</span><span class="hl-1">, </span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-4">volume</span><span class="hl-1">]) </span><span class="hl-3">=></span><span class="hl-1"> ({</span><br/><span class="hl-1"> </span><span class="hl-4">timestamp</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">open</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">high</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">low</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">close</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">volume</span><span class="hl-1">,</span><br/><span class="hl-1"> }));</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">addFrameSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">frameName:</span><span class="hl-1"> </span><span class="hl-2">"feb_2026_frame"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"1m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">startDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2026-02-01T00:00:00Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-4">endDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2026-02-28T23:59:59Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-2">"February 2026"</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">addStrategySchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"feb_2026_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"1m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getSignal</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">resolve</span><span class="hl-1">(</span><span class="hl-4">signalOutput</span><span class="hl-1">),</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">listenError</span><span class="hl-1">((</span><span class="hl-4">error</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">Log</span><span class="hl-1">.</span><span class="hl-0">debug</span><span class="hl-1">(</span><span class="hl-2">"error"</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">error:</span><span class="hl-1"> </span><span class="hl-0">errorData</span><span class="hl-1">(</span><span class="hl-4">error</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-4">message:</span><span class="hl-1"> </span><span class="hl-0">getErrorMessage</span><span class="hl-1">(</span><span class="hl-4">error</span><span class="hl-1">),</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">});</span>
|
| 217 |
</code><button type="button">Copy</button></pre>
|
| 218 |
|
| 219 |
<blockquote>
|
| 220 |
<p>feb_2026.pine</p>
|
| 221 |
</blockquote>
|
| 222 |
+
<pre><code class="javascript"><span class="hl-6">//@version=5</span><br/><span class="hl-6">// ============================================================</span><br/><span class="hl-6">// feb_2026.pine — LiquidationSpike Bounce LONG | BTCUSDT 15m</span><br/><span class="hl-6">// Test period: 2026-02-01 — 2026-02-28</span><br/><span class="hl-6">// ============================================================</span><br/><span class="hl-6">// Market context February 2026:</span><br/><span class="hl-6">// BTC: 78K → 60K (crash Feb 5, -17% in 1 day) → bounce 70K → down again to 62K (Feb 23)</span><br/><span class="hl-6">// Structure: hard bear trend with liquidation cascades and V-bounces.</span><br/><span class="hl-6">// Drivers: Trump tariffs, ETF outflows -$3.8B, $2.56B in liquidations in 1 day.</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Trade idea (Liquidation Spike Bounce):</span><br/><span class="hl-6">// After a liquidation cascade (abnormal volume + large single-bar drop),</span><br/><span class="hl-6">// the market produces a V-bounce of 1.5-4% within 1-8 bars. Enter on the first reversal candle.</span><br/><span class="hl-6">// Cooldown: ignore new signals for 20 bars after the previous entry.</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Entry conditions:</span><br/><span class="hl-6">// 1. Bear context: close < EMA50</span><br/><span class="hl-6">// 2. Spike[1]: (open[1]-close[1]) > 2.0*ATR14 AND drop > 0.6% of price (liquidation candle)</span><br/><span class="hl-6">// 3. Volume[1] > 1.8 * SMA(volume,20)</span><br/><span class="hl-6">// 4. Bounce bar: close > open AND close > low[1]</span><br/><span class="hl-6">// 5. Cooldown: barsSinceRaw >= 20 (no more than one entry per 5h)</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Exits (strictly fixed, no trailing):</span><br/><span class="hl-6">// TP: +1.5% from entryPrice</span><br/><span class="hl-6">// SL: -0.8% from entryPrice</span><br/><span class="hl-6">// RSI exit: rsi > 60 (momentum exhausted)</span><br/><span class="hl-6">// Time exit: 20 bars (5 hours)</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// Risk/Reward: 1.875 | Commission: 0.4% round trip</span><br/><span class="hl-6">//</span><br/><span class="hl-6">// BACKTEST RESULTS 2026-02-01 — 2026-02-28:</span><br/><span class="hl-6">// Trades: 3 (~1 trade every 9 days)</span><br/><span class="hl-6">// WinRate: 100% (3W / 0L)</span><br/><span class="hl-6">// Gross PnL: +5.34%</span><br/><span class="hl-6">// Net PnL (−0.4% commission × 3): +4.14%</span><br/><span class="hl-6">// AvgPnL: +1.78% per trade</span><br/><span class="hl-6">// sharpeRatio: N/A (0 losses, StdDev not applicable)</span><br/><span class="hl-6">// Trades:</span><br/><span class="hl-6">// 02-06 00:15 LONG ep=61373 exit=62966 +2.59% (V-bounce after $60K flash crash)</span><br/><span class="hl-6">// 02-10 14:45 LONG ep=68460 exit=69287 +1.21% (bounce after liquidation cascade)</span><br/><span class="hl-6">// 02-23 02:00 LONG ep=64763 exit=65762 +1.54% (bounce after tariff shock crash)</span><br/><span class="hl-6">// Note: strategy stays flat during quiet periods (Feb 11-22, Feb 24-28) —</span><br/><span class="hl-6">// this is intentional; no edge in ranging markets.</span><br/><span class="hl-6">// ============================================================</span><br/><br/><span class="hl-0">indicator</span><span class="hl-1">(</span><span class="hl-2">"LiqSpikeBounceLong Feb2026"</span><span class="hl-1">, </span><span class="hl-4">overlay</span><span class="hl-1">=</span><span class="hl-3">true</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Inputs ---</span><br/><span class="hl-4">emaLen</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">50</span><span class="hl-1">, </span><span class="hl-2">"EMA Bear Filter"</span><span class="hl-1">)</span><br/><span class="hl-4">atrLen</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">14</span><span class="hl-1">, </span><span class="hl-2">"ATR Period"</span><span class="hl-1">)</span><br/><span class="hl-4">spikeMul</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">2.0</span><span class="hl-1">,</span><span class="hl-2">"Spike ATR Multiplier"</span><span class="hl-1">)</span><br/><span class="hl-4">volLen</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">20</span><span class="hl-1">, </span><span class="hl-2">"Volume Avg Period"</span><span class="hl-1">)</span><br/><span class="hl-4">volMul</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">1.8</span><span class="hl-1">,</span><span class="hl-2">"Volume Spike Multiplier"</span><span class="hl-1">)</span><br/><span class="hl-4">rsiLen</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">14</span><span class="hl-1">, </span><span class="hl-2">"RSI Period"</span><span class="hl-1">)</span><br/><span class="hl-4">rsiExit</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">60</span><span class="hl-1">, </span><span class="hl-2">"RSI Exit Level"</span><span class="hl-1">)</span><br/><span class="hl-4">maxBars</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">20</span><span class="hl-1">, </span><span class="hl-2">"Max Hold Bars (5h)"</span><span class="hl-1">)</span><br/><span class="hl-4">cooldown</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">int</span><span class="hl-1">(</span><span class="hl-7">20</span><span class="hl-1">, </span><span class="hl-2">"Cooldown Bars Between Entries"</span><span class="hl-1">)</span><br/><span class="hl-4">tpPct</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">1.5</span><span class="hl-1">,</span><span class="hl-2">"TP %"</span><span class="hl-1">) / </span><span class="hl-7">100</span><br/><span class="hl-4">slPct</span><span class="hl-1"> = </span><span class="hl-4">input</span><span class="hl-1">.</span><span class="hl-0">float</span><span class="hl-1">(</span><span class="hl-7">0.8</span><span class="hl-1">,</span><span class="hl-2">"SL %"</span><span class="hl-1">) / </span><span class="hl-7">100</span><br/><br/><span class="hl-6">// --- Indicators ---</span><br/><span class="hl-4">ema50</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">ema</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-4">emaLen</span><span class="hl-1">)</span><br/><span class="hl-4">atr14</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">atr</span><span class="hl-1">(</span><span class="hl-4">atrLen</span><span class="hl-1">)</span><br/><span class="hl-4">avgVol</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">sma</span><span class="hl-1">(</span><span class="hl-4">volume</span><span class="hl-1">, </span><span class="hl-4">volLen</span><span class="hl-1">)</span><br/><span class="hl-4">rsi</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">rsi</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-4">rsiLen</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Signal conditions ---</span><br/><span class="hl-4">bearFilter</span><span class="hl-1"> = </span><span class="hl-4">close</span><span class="hl-1"> < </span><span class="hl-4">ema50</span><br/><br/><span class="hl-6">// Spike bar: must exceed ATR multiplier AND be at least 0.6% of price in absolute terms.</span><br/><span class="hl-6">// The 0.6% floor filters out false spikes during ultra-low-volatility periods</span><br/><span class="hl-6">// where even a $200 drop can exceed 2×ATR (ATR collapses in quiet markets).</span><br/><span class="hl-4">spikeDrop</span><span class="hl-1"> = </span><span class="hl-4">open</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] - </span><span class="hl-4">close</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">]</span><br/><span class="hl-4">spikeBar</span><span class="hl-1"> = </span><span class="hl-4">spikeDrop</span><span class="hl-1"> > </span><span class="hl-4">spikeMul</span><span class="hl-1"> * </span><span class="hl-4">atr14</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">close</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] < </span><span class="hl-4">open</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">]</span><br/><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">spikeDrop</span><span class="hl-1"> > </span><span class="hl-4">close</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] * </span><span class="hl-7">0.006</span><br/><br/><span class="hl-4">volSpike</span><span class="hl-1"> = </span><span class="hl-4">volume</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">] > </span><span class="hl-4">volMul</span><span class="hl-1"> * </span><span class="hl-4">avgVol</span><br/><span class="hl-4">bounceBar</span><span class="hl-1"> = </span><span class="hl-4">close</span><span class="hl-1"> > </span><span class="hl-4">open</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">close</span><span class="hl-1"> > </span><span class="hl-4">low</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">]</span><br/><br/><span class="hl-4">rawSignal</span><span class="hl-1"> = </span><span class="hl-4">bearFilter</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">spikeBar</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">volSpike</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">bounceBar</span><br/><br/><span class="hl-6">// Cooldown через rawSignal[1]: сколько баров прошло с предыдущего rawSignal</span><br/><span class="hl-4">barsSinceRaw</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">barssince</span><span class="hl-1">(</span><span class="hl-4">rawSignal</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">])</span><br/><br/><span class="hl-6">// Входим только если последний сигнал был давно (cooldown)</span><br/><span class="hl-4">longEntry</span><span class="hl-1"> = </span><span class="hl-4">rawSignal</span><span class="hl-1"> </span><span class="hl-0">and</span><span class="hl-1"> (</span><span class="hl-0">na</span><span class="hl-1">(</span><span class="hl-4">barsSinceRaw</span><span class="hl-1">) </span><span class="hl-4">or</span><span class="hl-1"> </span><span class="hl-4">barsSinceRaw</span><span class="hl-1"> >= </span><span class="hl-4">cooldown</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Position tracking ---</span><br/><span class="hl-4">barsSinceEntry</span><span class="hl-1"> = </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">barssince</span><span class="hl-1">(</span><span class="hl-4">longEntry</span><span class="hl-1">)</span><br/><br/><span class="hl-4">entryPrice</span><span class="hl-1"> = </span><span class="hl-4">longEntry</span><span class="hl-1"> ? </span><span class="hl-4">close</span><span class="hl-1"> : </span><span class="hl-4">close</span><span class="hl-1">[</span><span class="hl-4">barsSinceEntry</span><span class="hl-1">]</span><br/><span class="hl-4">entryTP</span><span class="hl-1"> = </span><span class="hl-4">entryPrice</span><span class="hl-1"> * (</span><span class="hl-7">1</span><span class="hl-1"> + </span><span class="hl-4">tpPct</span><span class="hl-1">)</span><br/><span class="hl-4">entrySL</span><span class="hl-1"> = </span><span class="hl-4">entryPrice</span><span class="hl-1"> * (</span><span class="hl-7">1</span><span class="hl-1"> - </span><span class="hl-4">slPct</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// --- Exit Conditions ---</span><br/><span class="hl-6">// Use high/low (wick prices) to match real exchange fill behaviour.</span><br/><span class="hl-6">// barsSinceEntry > 0 guard: skip the entry bar itself — entry is at close,</span><br/><span class="hl-6">// so the entry bar's own wick must not trigger an immediate exit.</span><br/><span class="hl-4">hitTP</span><span class="hl-1"> = </span><span class="hl-4">barsSinceEntry</span><span class="hl-1"> > </span><span class="hl-7">0</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">highest</span><span class="hl-1">(</span><span class="hl-4">high</span><span class="hl-1">, </span><span class="hl-4">barsSinceEntry</span><span class="hl-1">) >= </span><span class="hl-4">entryTP</span><br/><span class="hl-4">hitSL</span><span class="hl-1"> = </span><span class="hl-4">barsSinceEntry</span><span class="hl-1"> > </span><span class="hl-7">0</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">ta</span><span class="hl-1">.</span><span class="hl-0">lowest</span><span class="hl-1">(</span><span class="hl-4">low</span><span class="hl-1">, </span><span class="hl-4">barsSinceEntry</span><span class="hl-1">) <= </span><span class="hl-4">entrySL</span><br/><span class="hl-4">rsiDone</span><span class="hl-1"> = </span><span class="hl-4">rsi</span><span class="hl-1"> > </span><span class="hl-4">rsiExit</span><br/><span class="hl-4">timeLimit</span><span class="hl-1"> = </span><span class="hl-4">barsSinceEntry</span><span class="hl-1"> >= </span><span class="hl-4">maxBars</span><br/><br/><span class="hl-4">inPosition</span><span class="hl-1"> = </span><span class="hl-4">not</span><span class="hl-1"> </span><span class="hl-0">na</span><span class="hl-1">(</span><span class="hl-4">barsSinceEntry</span><span class="hl-1">) </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">not</span><span class="hl-1"> </span><span class="hl-4">hitTP</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">not</span><span class="hl-1"> </span><span class="hl-4">hitSL</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">not</span><span class="hl-1"> </span><span class="hl-4">rsiDone</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">not</span><span class="hl-1"> </span><span class="hl-4">timeLimit</span><br/><br/><span class="hl-4">position</span><span class="hl-1"> = </span><span class="hl-4">inPosition</span><span class="hl-1"> ? </span><span class="hl-7">1</span><span class="hl-1"> : </span><span class="hl-7">0</span><br/><br/><span class="hl-6">// === OUTPUTS FOR BOT ===</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">position</span><span class="hl-1">, </span><span class="hl-2">"Position"</span><span class="hl-1">, </span><span class="hl-4">display</span><span class="hl-1">=</span><span class="hl-4">display</span><span class="hl-1">.</span><span class="hl-4">data_window</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-4">entryTP</span><span class="hl-1"> : </span><span class="hl-4">na</span><span class="hl-1">, </span><span class="hl-2">"TP"</span><span class="hl-1">, </span><span class="hl-4">display</span><span class="hl-1">=</span><span class="hl-4">display</span><span class="hl-1">.</span><span class="hl-4">data_window</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-4">entrySL</span><span class="hl-1"> : </span><span class="hl-4">na</span><span class="hl-1">, </span><span class="hl-2">"SL"</span><span class="hl-1">, </span><span class="hl-4">display</span><span class="hl-1">=</span><span class="hl-4">display</span><span class="hl-1">.</span><span class="hl-4">data_window</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-4">entryPrice</span><span class="hl-1"> : </span><span class="hl-4">na</span><span class="hl-1">, </span><span class="hl-2">"EntryPrice"</span><span class="hl-1">, </span><span class="hl-4">display</span><span class="hl-1">=</span><span class="hl-4">display</span><span class="hl-1">.</span><span class="hl-4">data_window</span><span class="hl-1">)</span><br/><br/><span class="hl-6">// === VISUAL ===</span><br/><span class="hl-4">lineColor</span><span class="hl-1"> = </span><span class="hl-4">position</span><span class="hl-1"> == </span><span class="hl-7">0</span><span class="hl-1"> ? </span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-4">gray</span><span class="hl-1"> : </span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-4">green</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-2">"Price"</span><span class="hl-1">, </span><span class="hl-4">color</span><span class="hl-1">=</span><span class="hl-4">lineColor</span><span class="hl-1">, </span><span class="hl-4">linewidth</span><span class="hl-1">=</span><span class="hl-7">2</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">ema50</span><span class="hl-1">, </span><span class="hl-2">"EMA50"</span><span class="hl-1">, </span><span class="hl-4">color</span><span class="hl-1">=</span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-0">new</span><span class="hl-1">(</span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-4">orange</span><span class="hl-1">, </span><span class="hl-7">50</span><span class="hl-1">), </span><span class="hl-4">linewidth</span><span class="hl-1">=</span><span class="hl-7">1</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-4">entryTP</span><span class="hl-1"> : </span><span class="hl-4">na</span><span class="hl-1">, </span><span class="hl-2">"TP Line"</span><span class="hl-1">, </span><span class="hl-4">color</span><span class="hl-1">=</span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-0">new</span><span class="hl-1">(</span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-4">green</span><span class="hl-1">, </span><span class="hl-7">30</span><span class="hl-1">), </span><span class="hl-4">linewidth</span><span class="hl-1">=</span><span class="hl-7">1</span><span class="hl-1">)</span><br/><span class="hl-0">plot</span><span class="hl-1">(</span><span class="hl-4">position</span><span class="hl-1"> == </span><span class="hl-7">1</span><span class="hl-1"> ? </span><span class="hl-4">entrySL</span><span class="hl-1"> : </span><span class="hl-4">na</span><span class="hl-1">, </span><span class="hl-2">"SL Line"</span><span class="hl-1">, </span><span class="hl-4">color</span><span class="hl-1">=</span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-0">new</span><span class="hl-1">(</span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-4">red</span><span class="hl-1">, </span><span class="hl-7">30</span><span class="hl-1">), </span><span class="hl-4">linewidth</span><span class="hl-1">=</span><span class="hl-7">1</span><span class="hl-1">)</span><br/><span class="hl-0">plotshape</span><span class="hl-1">(</span><span class="hl-4">longEntry</span><span class="hl-1">, </span><span class="hl-2">"Entry"</span><span class="hl-1">, </span><span class="hl-4">shape</span><span class="hl-1">.</span><span class="hl-4">triangleup</span><span class="hl-1">, </span><span class="hl-4">location</span><span class="hl-1">.</span><span class="hl-4">belowbar</span><span class="hl-1">, </span><span class="hl-4">color</span><span class="hl-1">.</span><span class="hl-4">green</span><span class="hl-1">, </span><span class="hl-4">size</span><span class="hl-1">=</span><span class="hl-4">size</span><span class="hl-1">.</span><span class="hl-4">small</span><span class="hl-1">)</span>
|
| 223 |
</code><button type="button">Copy</button></pre>
|
| 224 |
|
| 225 |
<blockquote>
|
documents/article_06_ai_strategy_blueprint.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
documents/article_07_ai_news_trading_signals.html
CHANGED
|
@@ -42,7 +42,7 @@
|
|
| 42 |
<li><a href="http://wsj.com">wsj.com</a></li>
|
| 43 |
</ul>
|
| 44 |
<p>In Tavily's database, these are assigned a timestamp of <code>Thu, ?? Jan ???? 00:00:00 GMT</code>. To filter them out, cast to UTC — otherwise your local timezone will be used as an offset:</p>
|
| 45 |
-
<pre><code class="js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">hour</span><span class="hl-1"> = </span><span class="hl-0">dayjs</span><span class="hl-1">(</span><span class="hl-
|
| 46 |
</code><button type="button">Copy</button></pre>
|
| 47 |
|
| 48 |
<p><strong>2. Query data from -2 days back and filter the last 24 hours on your side.</strong></p>
|
|
|
|
| 42 |
<li><a href="http://wsj.com">wsj.com</a></li>
|
| 43 |
</ul>
|
| 44 |
<p>In Tavily's database, these are assigned a timestamp of <code>Thu, ?? Jan ???? 00:00:00 GMT</code>. To filter them out, cast to UTC — otherwise your local timezone will be used as an offset:</p>
|
| 45 |
+
<pre><code class="js"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">hour</span><span class="hl-1"> = </span><span class="hl-0">dayjs</span><span class="hl-1">(</span><span class="hl-4">publishedDate</span><span class="hl-1">).</span><span class="hl-0">utc</span><span class="hl-1">().</span><span class="hl-0">get</span><span class="hl-1">(</span><span class="hl-2">"hour"</span><span class="hl-1">);</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">minute</span><span class="hl-1"> = </span><span class="hl-0">dayjs</span><span class="hl-1">(</span><span class="hl-4">publishedDate</span><span class="hl-1">).</span><span class="hl-0">utc</span><span class="hl-1">().</span><span class="hl-0">get</span><span class="hl-1">(</span><span class="hl-2">"minute"</span><span class="hl-1">);</span><br/><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">hour</span><span class="hl-1"> === </span><span class="hl-7">0</span><span class="hl-1"> && </span><span class="hl-4">minute</span><span class="hl-1"> === </span><span class="hl-7">0</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">warn</span><span class="hl-1">(</span><span class="hl-2">`fetchNews search invalid publishedDate query=</span><span class="hl-3">${</span><span class="hl-4">query</span><span class="hl-3">}</span><span class="hl-2"> url=</span><span class="hl-3">${</span><span class="hl-4">url</span><span class="hl-3">}</span><span class="hl-2"> from=</span><span class="hl-3">${</span><span class="hl-4">from</span><span class="hl-3">}</span><span class="hl-2"> to=</span><span class="hl-3">${</span><span class="hl-4">to</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">)</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">false</span><span class="hl-1">;</span><br/><span class="hl-1">}</span>
|
| 46 |
</code><button type="button">Copy</button></pre>
|
| 47 |
|
| 48 |
<p><strong>2. Query data from -2 days back and filter the last 24 hours on your side.</strong></p>
|
documents/article_08_ai_liquidity_harvesting.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
| 20 |
<strong>Portfolio Sharpe:</strong> 1.08<br>
|
| 21 |
<strong>Avg Peak PNL:</strong> 1.44%<br>
|
| 22 |
<strong>Avg Max Drawdown PNL:</strong> −0.48%</p>
|
| 23 |
-
<a id="source-code" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Source Code<a href="#source-code" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="javascript"><span class="hl-0">addStrategySchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"jan_2026_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getSignal</span><span class="hl-5">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-5">when</span><span class="hl-1">, </span><span class="hl-5">currentPrice</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">signal</span><span class="hl-1"> = </span><span class="hl-0">getActiveSignal</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-5">when</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (!</span><span class="hl-5">signal</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">close_1m</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getClosePrice</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-2">"1m"</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">close_1m</span><span class="hl-1"> < </span><span class="hl-5">signal</span><span class="hl-1">.</span><span class="hl-5">entry</span><span class="hl-1">.</span><span class="hl-5">from</span><span class="hl-1"> || </span><span class="hl-5">close_1m</span><span class="hl-1"> > </span><span class="hl-5">signal</span><span class="hl-1">.</span><span class="hl-5">entry</span><span class="hl-1">.</span><span class="hl-5">to</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> [</span><span class="hl-8">close_4h_prev</span><span class="hl-1">, </span><span class="hl-8">close_4h_cur</span><span class="hl-1">] = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-2">"4h"</span><span class="hl-1">, </span><span class="hl-7">2</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">range_high</span><span class="hl-1"> = </span><span class="hl-5">Math</span><span class="hl-1">.</span><span class="hl-0">max</span><span class="hl-1">(</span><span class="hl-5">close_4h_prev</span><span class="hl-1">.</span><span class="hl-5">high</span><span class="hl-1">, </span><span class="hl-5">close_4h_cur</span><span class="hl-1">.</span><span class="hl-5">high</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">range_low</span><span class="hl-1"> = </span><span class="hl-5">Math</span><span class="hl-1">.</span><span class="hl-0">min</span><span class="hl-1">(</span><span class="hl-5">close_4h_prev</span><span class="hl-1">.</span><span class="hl-5">low</span><span class="hl-1">, </span><span class="hl-5">close_4h_cur</span><span class="hl-1">.</span><span class="hl-5">low</span><span class="hl-1">); </span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">range_middle</span><span class="hl-1"> = (</span><span class="hl-5">range_high</span><span class="hl-1"> + </span><span class="hl-5">range_low</span><span class="hl-1">) / </span><span class="hl-7">2</span><span class="hl-1">; </span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">position</span><span class="hl-1"> = </span><span class="hl-5">close_1m</span><span class="hl-1"> > </span><span class="hl-5">range_middle</span><span class="hl-1"> ? </span><span class="hl-2">"short"</span><span class="hl-1"> : </span><span class="hl-2">"long"</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">position</span><span class="hl-1">,</span><br/><span class="hl-1"> ...</span><span class="hl-5">Position</span><span class="hl-1">.</span><span class="hl-0">moonbag</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">position</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">currentPrice</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">percentStopLoss:</span><span class="hl-1"> </span><span class="hl-8">HARD_STOP</span><span class="hl-1">,</span><br/><span class="hl-1"> }),</span><br/><span class="hl-1"> </span><span class="hl-5">minuteEstimatedTime:</span><span class="hl-1"> </span><span class="hl-7">24</span><span class="hl-1"> * </span><span class="hl-7">60</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">note:</span><span class="hl-1"> </span><span class="hl-5">signal</span><span class="hl-1">.</span><span class="hl-5">note</span><span class="hl-1">,</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">listenActivePing</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-5">data</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">peakProfitDistance</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getPositionHighestProfitDistancePnlPercentage</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">currentProfit</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getPositionPnlPercent</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">currentProfit</span><span class="hl-1"> < </span><span class="hl-7">0</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">peakProfitDistance</span><span class="hl-1"> < </span><span class="hl-8">TRAILING_TAKE</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">Log</span><span class="hl-1">.</span><span class="hl-0">info</span><span class="hl-1">(</span><span class="hl-2">"position closed due to the trailing take"</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">data</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">commitClosePending</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">id:</span><span class="hl-1"> </span><span class="hl-2">"unknown"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">note:</span><span class="hl-1"> </span><span class="hl-5">str</span><span class="hl-1">.</span><span class="hl-0">newline</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"# Позиция закрыта по trailing take"</span><span class="hl-1">,</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">listenActivePing</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-5">data</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">peakProfitCost</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getPositionHighestPnlPercentage</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">peakProfitMinutes</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">getPositionHighestProfitMinutes</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">peakProfitCost</span><span class="hl-1"> < </span><span class="hl-8">PEAK_STALENESS_SINCE_PROFIT</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">peakProfitMinutes</span><span class="hl-1"> < </span><span class="hl-8">PEAK_STALENESS_SINCE_MINUTES</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">Log</span><span class="hl-1">.</span><span class="hl-0">info</span><span class="hl-1">(</span><span class="hl-2">"position closed due to the peak staleness"</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">data</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">commitClosePending</span><span class="hl-1">(</span><span class="hl-5">symbol</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-5">id:</span><span class="hl-1"> </span><span class="hl-2">"unknown"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">note:</span><span class="hl-1"> </span><span class="hl-5">str</span><span class="hl-1">.</span><span class="hl-0">newline</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"# Позиция закрыта по peak staleness"</span><span class="hl-1">,</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">});</span>
|
| 24 |
</code><button type="button">Copy</button></pre>
|
| 25 |
|
| 26 |
<a id="thanks-for-reading" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Thanks for reading!<a href="#thanks-for-reading" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2></div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#🔪-ai-liquidity-harvesting-machine"><span>🔪 AI <wbr/>Liquidity <wbr/>Harvesting <wbr/>Machine</span></a><ul><li><a href="#cracking-open-the-tamagotchi"><span>Cracking <wbr/>Open the <wbr/>Tamagotchi</span></a></li><li><a href="#inverting-the-signal-and-trading-the-counter-trend"><span>Inverting the <wbr/>Signal and <wbr/>Trading the <wbr/>Counter-<wbr/>Trend</span></a></li><li><a href="#performance"><span>Performance</span></a></li><li><a href="#source-code"><span>Source <wbr/>Code</span></a></li><li><a href="#thanks-for-reading"><span>Thanks for reading!</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
|
|
| 20 |
<strong>Portfolio Sharpe:</strong> 1.08<br>
|
| 21 |
<strong>Avg Peak PNL:</strong> 1.44%<br>
|
| 22 |
<strong>Avg Max Drawdown PNL:</strong> −0.48%</p>
|
| 23 |
+
<a id="source-code" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Source Code<a href="#source-code" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="javascript"><span class="hl-0">addStrategySchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"jan_2026_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getSignal</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">when</span><span class="hl-1">, </span><span class="hl-4">currentPrice</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">signal</span><span class="hl-1"> = </span><span class="hl-0">getActiveSignal</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">when</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (!</span><span class="hl-4">signal</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">close_1m</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getClosePrice</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-2">"1m"</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">close_1m</span><span class="hl-1"> < </span><span class="hl-4">signal</span><span class="hl-1">.</span><span class="hl-4">entry</span><span class="hl-1">.</span><span class="hl-4">from</span><span class="hl-1"> || </span><span class="hl-4">close_1m</span><span class="hl-1"> > </span><span class="hl-4">signal</span><span class="hl-1">.</span><span class="hl-4">entry</span><span class="hl-1">.</span><span class="hl-4">to</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-3">null</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> [</span><span class="hl-8">close_4h_prev</span><span class="hl-1">, </span><span class="hl-8">close_4h_cur</span><span class="hl-1">] = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-2">"4h"</span><span class="hl-1">, </span><span class="hl-7">2</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">range_high</span><span class="hl-1"> = </span><span class="hl-4">Math</span><span class="hl-1">.</span><span class="hl-0">max</span><span class="hl-1">(</span><span class="hl-4">close_4h_prev</span><span class="hl-1">.</span><span class="hl-4">high</span><span class="hl-1">, </span><span class="hl-4">close_4h_cur</span><span class="hl-1">.</span><span class="hl-4">high</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">range_low</span><span class="hl-1"> = </span><span class="hl-4">Math</span><span class="hl-1">.</span><span class="hl-0">min</span><span class="hl-1">(</span><span class="hl-4">close_4h_prev</span><span class="hl-1">.</span><span class="hl-4">low</span><span class="hl-1">, </span><span class="hl-4">close_4h_cur</span><span class="hl-1">.</span><span class="hl-4">low</span><span class="hl-1">); </span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">range_middle</span><span class="hl-1"> = (</span><span class="hl-4">range_high</span><span class="hl-1"> + </span><span class="hl-4">range_low</span><span class="hl-1">) / </span><span class="hl-7">2</span><span class="hl-1">; </span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">position</span><span class="hl-1"> = </span><span class="hl-4">close_1m</span><span class="hl-1"> > </span><span class="hl-4">range_middle</span><span class="hl-1"> ? </span><span class="hl-2">"short"</span><span class="hl-1"> : </span><span class="hl-2">"long"</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">position</span><span class="hl-1">,</span><br/><span class="hl-1"> ...</span><span class="hl-4">Position</span><span class="hl-1">.</span><span class="hl-0">moonbag</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">position</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">currentPrice</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">percentStopLoss:</span><span class="hl-1"> </span><span class="hl-8">HARD_STOP</span><span class="hl-1">,</span><br/><span class="hl-1"> }),</span><br/><span class="hl-1"> </span><span class="hl-4">minuteEstimatedTime:</span><span class="hl-1"> </span><span class="hl-7">24</span><span class="hl-1"> * </span><span class="hl-7">60</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-4">signal</span><span class="hl-1">.</span><span class="hl-4">note</span><span class="hl-1">,</span><br/><span class="hl-1"> };</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">listenActivePing</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">data</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">peakProfitDistance</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPositionHighestProfitDistancePnlPercentage</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">currentProfit</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPositionPnlPercent</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">currentProfit</span><span class="hl-1"> < </span><span class="hl-7">0</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">peakProfitDistance</span><span class="hl-1"> < </span><span class="hl-8">TRAILING_TAKE</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">Log</span><span class="hl-1">.</span><span class="hl-0">info</span><span class="hl-1">(</span><span class="hl-2">"position closed due to the trailing take"</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">data</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitClosePending</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">"unknown"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-4">str</span><span class="hl-1">.</span><span class="hl-0">newline</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"# Позиция закрыта по trailing take"</span><span class="hl-1">,</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-0">listenActivePing</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">data</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">peakProfitCost</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPositionHighestPnlPercentage</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">peakProfitMinutes</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPositionHighestProfitMinutes</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">peakProfitCost</span><span class="hl-1"> < </span><span class="hl-8">PEAK_STALENESS_SINCE_PROFIT</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">peakProfitMinutes</span><span class="hl-1"> < </span><span class="hl-8">PEAK_STALENESS_SINCE_MINUTES</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">Log</span><span class="hl-1">.</span><span class="hl-0">info</span><span class="hl-1">(</span><span class="hl-2">"position closed due to the peak staleness"</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">data</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitClosePending</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">"unknown"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-4">str</span><span class="hl-1">.</span><span class="hl-0">newline</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"# Позиция закрыта по peak staleness"</span><span class="hl-1">,</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">});</span>
|
| 24 |
</code><button type="button">Copy</button></pre>
|
| 25 |
|
| 26 |
<a id="thanks-for-reading" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Thanks for reading!<a href="#thanks-for-reading" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2></div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#🔪-ai-liquidity-harvesting-machine"><span>🔪 AI <wbr/>Liquidity <wbr/>Harvesting <wbr/>Machine</span></a><ul><li><a href="#cracking-open-the-tamagotchi"><span>Cracking <wbr/>Open the <wbr/>Tamagotchi</span></a></li><li><a href="#inverting-the-signal-and-trading-the-counter-trend"><span>Inverting the <wbr/>Signal and <wbr/>Trading the <wbr/>Counter-<wbr/>Trend</span></a></li><li><a href="#performance"><span>Performance</span></a></li><li><a href="#source-code"><span>Source <wbr/>Code</span></a></li><li><a href="#thanks-for-reading"><span>Thanks for reading!</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
documents/article_09_pinescript_local_markets.html
CHANGED
|
@@ -18,11 +18,11 @@
|
|
| 18 |
<p>Beyond the price chart, to avoid being limited to standard Excel, I wanted to apply the full range of Open Source tools rather than reinventing the wheel.</p>
|
| 19 |
<p><img src="../media/pine_markets_excel.png" alt=""></p>
|
| 20 |
<a id="building-candles-from-executed-trades" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Building Candles from Executed Trades<a href="#building-candles-from-executed-trades" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The first script downloads pages with trades. Excel could have been used, but it doesn't include minutes:</p>
|
| 21 |
-
<pre><code class="typescript"><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">main</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">buildUrl</span><span class="hl-1"> = (</span><span class="hl-
|
| 22 |
</code><button type="button">Copy</button></pre>
|
| 23 |
|
| 24 |
<p>The second script imports into MongoDB:</p>
|
| 25 |
-
<pre><code class="typescript"><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">parseHtmlTable</span><span class="hl-1">(</span><span class="hl-5">html</span><span class="hl-1">: </span><span class="hl-11">string</span><span class="hl-1">, </span><span class="hl-5">pageIndex</span><span class="hl-1">: </span><span class="hl-11">number</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">rows</span><span class="hl-1">: </span><span class="hl-11">object</span><span class="hl-1">[] = [];</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">trRegex</span><span class="hl-1"> =</span><span class="hl-17"> /<tr</span><span class="hl-18">[</span><span class="hl-17">\s\S</span><span class="hl-18">]</span><span class="hl-19">*?</span><span class="hl-17"><</span><span class="hl-13">\/</span><span class="hl-17">tr>/</span><span class="hl-3">gi</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tdRegex</span><span class="hl-1"> =</span><span class="hl-17"> /<td</span><span class="hl-18">[^</span><span class="hl-17">></span><span class="hl-18">]</span><span class="hl-19">*</span><span class="hl-17">></span><span class="hl-18">([</span><span class="hl-17">\s\S</span><span class="hl-18">]</span><span class="hl-19">*?</span><span class="hl-18">)</span><span class="hl-17"><</span><span class="hl-13">\/</span><span class="hl-17">td>/</span><span class="hl-3">gi</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tagRegex</span><span class="hl-1"> =</span><span class="hl-17"> /<</span><span class="hl-18">[^</span><span class="hl-17">></span><span class="hl-18">]</span><span class="hl-19">+</span><span class="hl-17">>/</span><span class="hl-3">g</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-5">rowIndex</span><span class="hl-1"> = </span><span class="hl-7">0</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">urlKey</span><span class="hl-1"> = </span><span class="hl-0">extractUrlKey</span><span class="hl-1">(</span><span class="hl-5">html</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-5">trMatch</span><span class="hl-1">: </span><span class="hl-11">RegExpExecArray</span><span class="hl-1"> | </span><span class="hl-11">null</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-4">while</span><span class="hl-1"> ((</span><span class="hl-5">trMatch</span><span class="hl-1"> = </span><span class="hl-5">trRegex</span><span class="hl-1">.</span><span class="hl-0">exec</span><span class="hl-1">(</span><span class="hl-5">html</span><span class="hl-1">)) !== </span><span class="hl-3">null</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">rowHtml</span><span class="hl-1"> = </span><span class="hl-5">trMatch</span><span class="hl-1">[</span><span class="hl-7">0</span><span class="hl-1">];</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">cells</span><span class="hl-1">: </span><span class="hl-11">string</span><span class="hl-1">[] = [];</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-5">tdMatch</span><span class="hl-1">: </span><span class="hl-11">RegExpExecArray</span><span class="hl-1"> | </span><span class="hl-11">null</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-4">while</span><span class="hl-1"> ((</span><span class="hl-5">tdMatch</span><span class="hl-1"> = </span><span class="hl-5">tdRegex</span><span class="hl-1">.</span><span class="hl-0">exec</span><span class="hl-1">(</span><span class="hl-5">rowHtml</span><span class="hl-1">)) !== </span><span class="hl-3">null</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">cells</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">(</span><span class="hl-5">tdMatch</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">].</span><span class="hl-0">replace</span><span class="hl-1">(</span><span class="hl-5">tagRegex</span><span class="hl-1">, </span><span class="hl-2">" "</span><span class="hl-1">).</span><span class="hl-0">replace</span><span class="hl-1">(</span><span class="hl-17">/\s</span><span class="hl-19">+</span><span class="hl-17">/</span><span class="hl-3">g</span><span class="hl-1">, </span><span class="hl-2">" "</span><span class="hl-1">).</span><span class="hl-0">trim</span><span class="hl-1">());</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">cells</span><span class="hl-1">.</span><span class="hl-5">length</span><span class="hl-1"> < </span><span class="hl-7">10</span><span class="hl-1">) </span><span class="hl-4">continue</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">symbolParts</span><span class="hl-1"> = </span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">2</span><span class="hl-1">].</span><span class="hl-0">split</span><span class="hl-1">(</span><span class="hl-17">/\s</span><span class="hl-19">+</span><span class="hl-17">/</span><span class="hl-1">).</span><span class="hl-0">filter</span><span class="hl-1">(</span><span class="hl-5">Boolean</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">volumeParts</span><span class="hl-1"> = </span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">9</span><span class="hl-1">].</span><span class="hl-0">split</span><span class="hl-1">(</span><span class="hl-17">/\s</span><span class="hl-19">+</span><span class="hl-17">/</span><span class="hl-1">).</span><span class="hl-0">filter</span><span class="hl-1">(</span><span class="hl-5">Boolean</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">time</span><span class="hl-1"> = </span><span class="hl-0">parseRuDate</span><span class="hl-1">(</span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">0</span><span class="hl-1">]);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">symbol</span><span class="hl-1"> = </span><span class="hl-5">symbolParts</span><span class="hl-1">[</span><span class="hl-7">0</span><span class="hl-1">] ?? </span><span class="hl-2">""</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tradePrice</span><span class="hl-1"> = </span><span class="hl-0">parseNumber</span><span class="hl-1">(</span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">7</span><span class="hl-1">]);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">quantity</span><span class="hl-1"> = </span><span class="hl-0">parseNumber</span><span class="hl-1">(</span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">8</span><span class="hl-1">]);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">volume</span><span class="hl-1"> = </span><span class="hl-0">parseNumber</span><span class="hl-1">(</span><span class="hl-5">volumeParts</span><span class="hl-1">[</span><span class="hl-5">volumeParts</span><span class="hl-1">.</span><span class="hl-5">length</span><span class="hl-1"> - </span><span class="hl-7">1</span><span class="hl-1">] ?? </span><span class="hl-2">""</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">hash</span><span class="hl-1"> = </span><span class="hl-5">crypto</span><br/><span class="hl-1"> .</span><span class="hl-0">createHash</span><span class="hl-1">(</span><span class="hl-2">"sha1"</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">update</span><span class="hl-1">(</span><span class="hl-2">`</span><span class="hl-3">${</span><span class="hl-5">symbol</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-5">time</span><span class="hl-9">?.</span><span class="hl-0">toISOString</span><span class="hl-9">()</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-5">tradePrice</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-5">quantity</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-5">volume</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-5">pageIndex</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-5">rowIndex</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-5">urlKey</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">digest</span><span class="hl-1">(</span><span class="hl-2">"hex"</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-5">rowIndex</span><span class="hl-1">++;</span><br/><span class="hl-1"> </span><span class="hl-5">rows</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">({ </span><span class="hl-5">time</span><span class="hl-1">, </span><span class="hl-5">symbol</span><span class="hl-1">, </span><span class="hl-5">issuer:</span><span class="hl-1"> </span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">3</span><span class="hl-1">], </span><span class="hl-5">securityType:</span><span class="hl-1"> </span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">4</span><span class="hl-1">], </span><span class="hl-5">market:</span><span class="hl-1"> </span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">5</span><span class="hl-1">], </span><span class="hl-5">platform:</span><span class="hl-1"> </span><span class="hl-5">cells</span><span class="hl-1">[</span><span class="hl-7">6</span><span class="hl-1">], </span><span class="hl-5">tradePrice</span><span class="hl-1">, </span><span class="hl-5">quantity</span><span class="hl-1">, </span><span class="hl-5">volume</span><span class="hl-1">, </span><span class="hl-5">hash</span><span class="hl-1"> });</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> </span><span class="hl-5">rows</span><span class="hl-1">.</span><span class="hl-0">filter</span><span class="hl-1">((</span><span class="hl-5">r</span><span class="hl-1">: </span><span class="hl-11">any</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-5">r</span><span class="hl-1">.</span><span class="hl-5">time</span><span class="hl-1"> !== </span><span class="hl-3">null</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
|
| 26 |
</code><button type="button">Copy</button></pre>
|
| 27 |
|
| 28 |
<a id="seeing-the-chart" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Seeing the Chart<a href="#seeing-the-chart" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p><img src="../media/pine_markets_chart.jpg" alt=""></p>
|
|
@@ -36,7 +36,7 @@
|
|
| 36 |
<p><img src="../media/pine_markets_history.png" alt=""></p>
|
| 37 |
<p>You can also view the history. It is visible that the price moved far above <code>SMA(20)</code> several times. <strong>The same pattern: several days without trading before it.</strong> Looks like a <code>single-price auction day</code>.</p>
|
| 38 |
<a id="how-to-connect-candles" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How to Connect Candles<a href="#how-to-connect-candles" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>File <code>./modules/editor.module.ts</code>:</p>
|
| 39 |
-
<pre><code class="typescript"><span class="hl-
|
| 40 |
</code><button type="button">Copy</button></pre>
|
| 41 |
|
| 42 |
<a id="how-to-run" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How to Run<a href="#how-to-run" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Via <code>npm start</code>:</p>
|
|
|
|
| 18 |
<p>Beyond the price chart, to avoid being limited to standard Excel, I wanted to apply the full range of Open Source tools rather than reinventing the wheel.</p>
|
| 19 |
<p><img src="../media/pine_markets_excel.png" alt=""></p>
|
| 20 |
<a id="building-candles-from-executed-trades" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Building Candles from Executed Trades<a href="#building-candles-from-executed-trades" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The first script downloads pages with trades. Excel could have been used, but it doesn't include minutes:</p>
|
| 21 |
+
<pre><code class="typescript"><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">main</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-0">buildUrl</span><span class="hl-1"> = (</span><span class="hl-4">p</span><span class="hl-1">: </span><span class="hl-11">number</span><span class="hl-1">) </span><span class="hl-3">=></span><br/><span class="hl-1"> </span><span class="hl-2">`https://uzse.uz/trade_results?begin=</span><span class="hl-3">${</span><span class="hl-4">begin</span><span class="hl-3">}</span><span class="hl-2">&end=</span><span class="hl-3">${</span><span class="hl-4">end</span><span class="hl-3">}</span><span class="hl-2">&mkt_id=</span><span class="hl-3">${</span><span class="hl-4">mktId</span><span class="hl-3">}</span><span class="hl-2">&page=</span><span class="hl-3">${</span><span class="hl-4">p</span><span class="hl-3">}</span><span class="hl-2">&search_key=</span><span class="hl-3">${</span><span class="hl-4">symbol</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">browser</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">chromium</span><span class="hl-1">.</span><span class="hl-0">launch</span><span class="hl-1">({ </span><span class="hl-4">headless:</span><span class="hl-1"> </span><span class="hl-3">true</span><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">page</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">browser</span><span class="hl-1">.</span><span class="hl-0">newPage</span><span class="hl-1">();</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">firstHtml</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">fetchPage</span><span class="hl-1">(</span><span class="hl-4">page</span><span class="hl-1">, </span><span class="hl-0">buildUrl</span><span class="hl-1">(</span><span class="hl-7">1</span><span class="hl-1">));</span><br/><span class="hl-1"> </span><span class="hl-4">fs</span><span class="hl-1">.</span><span class="hl-0">writeFileSync</span><span class="hl-1">(</span><span class="hl-4">path</span><span class="hl-1">.</span><span class="hl-0">join</span><span class="hl-1">(</span><span class="hl-8">TMP_DIR</span><span class="hl-1">, </span><span class="hl-2">"trades_page_1.html"</span><span class="hl-1">), </span><span class="hl-4">firstHtml</span><span class="hl-1">, </span><span class="hl-2">"utf8"</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">totalPages</span><span class="hl-1"> = </span><span class="hl-0">getLastPage</span><span class="hl-1">(</span><span class="hl-4">firstHtml</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Total pages: </span><span class="hl-3">${</span><span class="hl-4">totalPages</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-5">for</span><span class="hl-1"> (</span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-4">p</span><span class="hl-1"> = </span><span class="hl-7">2</span><span class="hl-1">; </span><span class="hl-4">p</span><span class="hl-1"> <= </span><span class="hl-4">totalPages</span><span class="hl-1">; </span><span class="hl-4">p</span><span class="hl-1">++) {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">html</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">fetchPage</span><span class="hl-1">(</span><span class="hl-4">page</span><span class="hl-1">, </span><span class="hl-0">buildUrl</span><span class="hl-1">(</span><span class="hl-4">p</span><span class="hl-1">));</span><br/><span class="hl-1"> </span><span class="hl-4">fs</span><span class="hl-1">.</span><span class="hl-0">writeFileSync</span><span class="hl-1">(</span><span class="hl-4">path</span><span class="hl-1">.</span><span class="hl-0">join</span><span class="hl-1">(</span><span class="hl-8">TMP_DIR</span><span class="hl-1">, </span><span class="hl-2">`trades_page_</span><span class="hl-3">${</span><span class="hl-4">p</span><span class="hl-3">}</span><span class="hl-2">.html`</span><span class="hl-1">), </span><span class="hl-4">html</span><span class="hl-1">, </span><span class="hl-2">"utf8"</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Downloaded page </span><span class="hl-3">${</span><span class="hl-4">p</span><span class="hl-3">}</span><span class="hl-2">/</span><span class="hl-3">${</span><span class="hl-4">totalPages</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">browser</span><span class="hl-1">.</span><span class="hl-0">close</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Done. HTML saved to </span><span class="hl-3">${</span><span class="hl-8">TMP_DIR</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
|
| 22 |
</code><button type="button">Copy</button></pre>
|
| 23 |
|
| 24 |
<p>The second script imports into MongoDB:</p>
|
| 25 |
+
<pre><code class="typescript"><span class="hl-3">function</span><span class="hl-1"> </span><span class="hl-0">parseHtmlTable</span><span class="hl-1">(</span><span class="hl-4">html</span><span class="hl-1">: </span><span class="hl-11">string</span><span class="hl-1">, </span><span class="hl-4">pageIndex</span><span class="hl-1">: </span><span class="hl-11">number</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">rows</span><span class="hl-1">: </span><span class="hl-11">object</span><span class="hl-1">[] = [];</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">trRegex</span><span class="hl-1"> =</span><span class="hl-17"> /<tr</span><span class="hl-18">[</span><span class="hl-17">\s\S</span><span class="hl-18">]</span><span class="hl-19">*?</span><span class="hl-17"><</span><span class="hl-13">\/</span><span class="hl-17">tr>/</span><span class="hl-3">gi</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tdRegex</span><span class="hl-1"> =</span><span class="hl-17"> /<td</span><span class="hl-18">[^</span><span class="hl-17">></span><span class="hl-18">]</span><span class="hl-19">*</span><span class="hl-17">></span><span class="hl-18">([</span><span class="hl-17">\s\S</span><span class="hl-18">]</span><span class="hl-19">*?</span><span class="hl-18">)</span><span class="hl-17"><</span><span class="hl-13">\/</span><span class="hl-17">td>/</span><span class="hl-3">gi</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tagRegex</span><span class="hl-1"> =</span><span class="hl-17"> /<</span><span class="hl-18">[^</span><span class="hl-17">></span><span class="hl-18">]</span><span class="hl-19">+</span><span class="hl-17">>/</span><span class="hl-3">g</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-4">rowIndex</span><span class="hl-1"> = </span><span class="hl-7">0</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">urlKey</span><span class="hl-1"> = </span><span class="hl-0">extractUrlKey</span><span class="hl-1">(</span><span class="hl-4">html</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-4">trMatch</span><span class="hl-1">: </span><span class="hl-11">RegExpExecArray</span><span class="hl-1"> | </span><span class="hl-11">null</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-5">while</span><span class="hl-1"> ((</span><span class="hl-4">trMatch</span><span class="hl-1"> = </span><span class="hl-4">trRegex</span><span class="hl-1">.</span><span class="hl-0">exec</span><span class="hl-1">(</span><span class="hl-4">html</span><span class="hl-1">)) !== </span><span class="hl-3">null</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">rowHtml</span><span class="hl-1"> = </span><span class="hl-4">trMatch</span><span class="hl-1">[</span><span class="hl-7">0</span><span class="hl-1">];</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">cells</span><span class="hl-1">: </span><span class="hl-11">string</span><span class="hl-1">[] = [];</span><br/><span class="hl-1"> </span><span class="hl-3">let</span><span class="hl-1"> </span><span class="hl-4">tdMatch</span><span class="hl-1">: </span><span class="hl-11">RegExpExecArray</span><span class="hl-1"> | </span><span class="hl-11">null</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-5">while</span><span class="hl-1"> ((</span><span class="hl-4">tdMatch</span><span class="hl-1"> = </span><span class="hl-4">tdRegex</span><span class="hl-1">.</span><span class="hl-0">exec</span><span class="hl-1">(</span><span class="hl-4">rowHtml</span><span class="hl-1">)) !== </span><span class="hl-3">null</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">cells</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">(</span><span class="hl-4">tdMatch</span><span class="hl-1">[</span><span class="hl-7">1</span><span class="hl-1">].</span><span class="hl-0">replace</span><span class="hl-1">(</span><span class="hl-4">tagRegex</span><span class="hl-1">, </span><span class="hl-2">" "</span><span class="hl-1">).</span><span class="hl-0">replace</span><span class="hl-1">(</span><span class="hl-17">/\s</span><span class="hl-19">+</span><span class="hl-17">/</span><span class="hl-3">g</span><span class="hl-1">, </span><span class="hl-2">" "</span><span class="hl-1">).</span><span class="hl-0">trim</span><span class="hl-1">());</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">cells</span><span class="hl-1">.</span><span class="hl-4">length</span><span class="hl-1"> < </span><span class="hl-7">10</span><span class="hl-1">) </span><span class="hl-5">continue</span><span class="hl-1">;</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">symbolParts</span><span class="hl-1"> = </span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">2</span><span class="hl-1">].</span><span class="hl-0">split</span><span class="hl-1">(</span><span class="hl-17">/\s</span><span class="hl-19">+</span><span class="hl-17">/</span><span class="hl-1">).</span><span class="hl-0">filter</span><span class="hl-1">(</span><span class="hl-4">Boolean</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">volumeParts</span><span class="hl-1"> = </span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">9</span><span class="hl-1">].</span><span class="hl-0">split</span><span class="hl-1">(</span><span class="hl-17">/\s</span><span class="hl-19">+</span><span class="hl-17">/</span><span class="hl-1">).</span><span class="hl-0">filter</span><span class="hl-1">(</span><span class="hl-4">Boolean</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">time</span><span class="hl-1"> = </span><span class="hl-0">parseRuDate</span><span class="hl-1">(</span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">0</span><span class="hl-1">]);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">symbol</span><span class="hl-1"> = </span><span class="hl-4">symbolParts</span><span class="hl-1">[</span><span class="hl-7">0</span><span class="hl-1">] ?? </span><span class="hl-2">""</span><span class="hl-1">;</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tradePrice</span><span class="hl-1"> = </span><span class="hl-0">parseNumber</span><span class="hl-1">(</span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">7</span><span class="hl-1">]);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">quantity</span><span class="hl-1"> = </span><span class="hl-0">parseNumber</span><span class="hl-1">(</span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">8</span><span class="hl-1">]);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">volume</span><span class="hl-1"> = </span><span class="hl-0">parseNumber</span><span class="hl-1">(</span><span class="hl-4">volumeParts</span><span class="hl-1">[</span><span class="hl-4">volumeParts</span><span class="hl-1">.</span><span class="hl-4">length</span><span class="hl-1"> - </span><span class="hl-7">1</span><span class="hl-1">] ?? </span><span class="hl-2">""</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">hash</span><span class="hl-1"> = </span><span class="hl-4">crypto</span><br/><span class="hl-1"> .</span><span class="hl-0">createHash</span><span class="hl-1">(</span><span class="hl-2">"sha1"</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">update</span><span class="hl-1">(</span><span class="hl-2">`</span><span class="hl-3">${</span><span class="hl-4">symbol</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-4">time</span><span class="hl-9">?.</span><span class="hl-0">toISOString</span><span class="hl-9">()</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-4">tradePrice</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-4">quantity</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-4">volume</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-4">pageIndex</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-4">rowIndex</span><span class="hl-3">}</span><span class="hl-2">|</span><span class="hl-3">${</span><span class="hl-4">urlKey</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">digest</span><span class="hl-1">(</span><span class="hl-2">"hex"</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-4">rowIndex</span><span class="hl-1">++;</span><br/><span class="hl-1"> </span><span class="hl-4">rows</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">({ </span><span class="hl-4">time</span><span class="hl-1">, </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">issuer:</span><span class="hl-1"> </span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">3</span><span class="hl-1">], </span><span class="hl-4">securityType:</span><span class="hl-1"> </span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">4</span><span class="hl-1">], </span><span class="hl-4">market:</span><span class="hl-1"> </span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">5</span><span class="hl-1">], </span><span class="hl-4">platform:</span><span class="hl-1"> </span><span class="hl-4">cells</span><span class="hl-1">[</span><span class="hl-7">6</span><span class="hl-1">], </span><span class="hl-4">tradePrice</span><span class="hl-1">, </span><span class="hl-4">quantity</span><span class="hl-1">, </span><span class="hl-4">volume</span><span class="hl-1">, </span><span class="hl-4">hash</span><span class="hl-1"> });</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">rows</span><span class="hl-1">.</span><span class="hl-0">filter</span><span class="hl-1">((</span><span class="hl-4">r</span><span class="hl-1">: </span><span class="hl-11">any</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">r</span><span class="hl-1">.</span><span class="hl-4">time</span><span class="hl-1"> !== </span><span class="hl-3">null</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
|
| 26 |
</code><button type="button">Copy</button></pre>
|
| 27 |
|
| 28 |
<a id="seeing-the-chart" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Seeing the Chart<a href="#seeing-the-chart" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p><img src="../media/pine_markets_chart.jpg" alt=""></p>
|
|
|
|
| 36 |
<p><img src="../media/pine_markets_history.png" alt=""></p>
|
| 37 |
<p>You can also view the history. It is visible that the price moved far above <code>SMA(20)</code> several times. <strong>The same pattern: several days without trading before it.</strong> Looks like a <code>single-price auction day</code>.</p>
|
| 38 |
<a id="how-to-connect-candles" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How to Connect Candles<a href="#how-to-connect-candles" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>File <code>./modules/editor.module.ts</code>:</p>
|
| 39 |
+
<pre><code class="typescript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">addExchangeSchema</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">CandleModel</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"../schema/Candle.schema"</span><span class="hl-1">;</span><br/><br/><span class="hl-5">import</span><span class="hl-1"> </span><span class="hl-2">"../config/setup"</span><span class="hl-1">;</span><br/><br/><span class="hl-0">addExchangeSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"mongo-exchange"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">interval</span><span class="hl-1">, </span><span class="hl-4">since</span><span class="hl-1">, </span><span class="hl-4">limit</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">candles</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">CandleModel</span><span class="hl-1">.</span><span class="hl-0">find</span><span class="hl-1">(</span><br/><span class="hl-1"> { </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">interval</span><span class="hl-1">, </span><span class="hl-4">timestamp:</span><span class="hl-1"> { </span><span class="hl-4">$gte:</span><span class="hl-1"> </span><span class="hl-4">since</span><span class="hl-1">.</span><span class="hl-0">getTime</span><span class="hl-1">() } },</span><br/><span class="hl-1"> { </span><span class="hl-4">timestamp:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-4">open:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-4">high:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-4">low:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-4">close:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-4">volume:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-4">_id:</span><span class="hl-1"> </span><span class="hl-7">0</span><span class="hl-1"> }</span><br/><span class="hl-1"> )</span><br/><span class="hl-1"> .</span><span class="hl-0">sort</span><span class="hl-1">({ </span><span class="hl-4">timestamp:</span><span class="hl-1"> </span><span class="hl-7">1</span><span class="hl-1"> })</span><br/><span class="hl-1"> .</span><span class="hl-0">limit</span><span class="hl-1">(</span><span class="hl-4">limit</span><span class="hl-1">)</span><br/><span class="hl-1"> .</span><span class="hl-0">lean</span><span class="hl-1">();</span><br/><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">candles</span><span class="hl-1">.</span><span class="hl-0">map</span><span class="hl-1">(({ </span><span class="hl-4">timestamp</span><span class="hl-1">, </span><span class="hl-4">open</span><span class="hl-1">, </span><span class="hl-4">high</span><span class="hl-1">, </span><span class="hl-4">low</span><span class="hl-1">, </span><span class="hl-4">close</span><span class="hl-1">, </span><span class="hl-4">volume</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> ({</span><br/><span class="hl-1"> </span><span class="hl-4">timestamp</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">open</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">high</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">low</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">close</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">volume</span><span class="hl-1">,</span><br/><span class="hl-1"> }));</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
|
| 40 |
</code><button type="button">Copy</button></pre>
|
| 41 |
|
| 42 |
<a id="how-to-run" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How to Run<a href="#how-to-run" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Via <code>npm start</code>:</p>
|
documents/article_10_dca_averaging_strategy.html
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
<a id="everything-is-going-according-to-plan" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Everything Is Going According to Plan<a href="#everything-is-going-according-to-plan" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Over the course of a month, the worst drawdown on a single trade was 13.92% (−$50.41). In reality, these funds aren't frozen — they're simply gone. The broker is just lying to you, telling you everything is fine. That's because their dashboard only shows closed positions: displaying real-time portfolio drawdowns would cause panic and trigger a mass withdrawal of funds from their scheme.</p>
|
| 17 |
<p><img src="../media/dca_drawdown_stats.png" alt=""></p>
|
| 18 |
<a id="but-what-happens-if-the-news-forecast-doesnt-play-out" class="tsd-anchor"></a><h2 class="tsd-anchor-link">But what happens if the news forecast doesn't play out?<a href="#but-what-happens-if-the-news-forecast-doesnt-play-out" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p><img src="../media/dca_bad_forecast.png" alt=""></p>
|
| 19 |
-
<a id="source-code" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Source code<a href="#source-code" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="javascript"><span class="hl-6">/**</span><br/><span class="hl-6"> * Averaging</span><br/><span class="hl-6"> */</span><br/><span class="hl-0">listenActivePing</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-
|
| 20 |
</code><button type="button">Copy</button></pre>
|
| 21 |
|
| 22 |
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#🥶-why-your-broker-froze-your-deposit-or-where-does-20-per-month-come-from"><span>🥶 <wbr/>Why <wbr/>Your <wbr/>Broker <wbr/>Froze <wbr/>Your <wbr/>Deposit or <wbr/>Where <wbr/>Does +20% <wbr/>Per <wbr/>Month <wbr/>Come <wbr/>From</span></a><ul><li><a href="#asset-price-averaging"><span>Asset <wbr/>Price <wbr/>Averaging</span></a></li><li><a href="#but-theres-a-catch"><span>But there's a catch.</span></a></li><li><a href="#everything-is-going-according-to-plan"><span>Everything <wbr/>Is <wbr/>Going <wbr/>According to <wbr/>Plan</span></a></li><li><a href="#but-what-happens-if-the-news-forecast-doesnt-play-out"><span>But what happens if the news forecast doesn't play out?</span></a></li><li><a href="#source-code"><span>Source code</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
|
|
| 16 |
<a id="everything-is-going-according-to-plan" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Everything Is Going According to Plan<a href="#everything-is-going-according-to-plan" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Over the course of a month, the worst drawdown on a single trade was 13.92% (−$50.41). In reality, these funds aren't frozen — they're simply gone. The broker is just lying to you, telling you everything is fine. That's because their dashboard only shows closed positions: displaying real-time portfolio drawdowns would cause panic and trigger a mass withdrawal of funds from their scheme.</p>
|
| 17 |
<p><img src="../media/dca_drawdown_stats.png" alt=""></p>
|
| 18 |
<a id="but-what-happens-if-the-news-forecast-doesnt-play-out" class="tsd-anchor"></a><h2 class="tsd-anchor-link">But what happens if the news forecast doesn't play out?<a href="#but-what-happens-if-the-news-forecast-doesnt-play-out" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p><img src="../media/dca_bad_forecast.png" alt=""></p>
|
| 19 |
+
<a id="source-code" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Source code<a href="#source-code" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="javascript"><span class="hl-6">/**</span><br/><span class="hl-6"> * Averaging</span><br/><span class="hl-6"> */</span><br/><span class="hl-0">listenActivePing</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">currentPrice</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">length</span><span class="hl-1">: </span><span class="hl-8">steps</span><span class="hl-1"> } = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPositionEntries</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">steps</span><span class="hl-1"> >= </span><span class="hl-8">LADDER_MAX_STEPS</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">hasOverlap</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPositionEntryOverlap</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">currentPrice</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">upperPercent:</span><span class="hl-1"> </span><span class="hl-8">LADDER_UPPER_STEP</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">lowerPercent:</span><span class="hl-1"> </span><span class="hl-8">LADDER_LOWER_STEP</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">hasOverlap</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitAverageBuy</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-8">LADDER_STEP_COST</span><span class="hl-1">);</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">/**</span><br/><span class="hl-6"> * Closing</span><br/><span class="hl-6"> */</span><br/><span class="hl-0">listenActivePing</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">data</span><span class="hl-1">, </span><span class="hl-4">timestamp</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-4">timestamp</span><span class="hl-1">));</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">currentProfit</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getPositionPnlPercent</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">currentProfit</span><span class="hl-1"> < </span><span class="hl-8">TARGET_PROFIT</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1">;</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> </span><span class="hl-4">Log</span><span class="hl-1">.</span><span class="hl-0">info</span><span class="hl-1">(</span><span class="hl-2">"position closed due to the target pnl reached"</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">symbol</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">data</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">commitClosePending</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">"unknown"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-4">str</span><span class="hl-1">.</span><span class="hl-0">newline</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"# Position closed on target PnL"</span><span class="hl-1">,</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">});</span>
|
| 20 |
</code><button type="button">Copy</button></pre>
|
| 21 |
|
| 22 |
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#🥶-why-your-broker-froze-your-deposit-or-where-does-20-per-month-come-from"><span>🥶 <wbr/>Why <wbr/>Your <wbr/>Broker <wbr/>Froze <wbr/>Your <wbr/>Deposit or <wbr/>Where <wbr/>Does +20% <wbr/>Per <wbr/>Month <wbr/>Come <wbr/>From</span></a><ul><li><a href="#asset-price-averaging"><span>Asset <wbr/>Price <wbr/>Averaging</span></a></li><li><a href="#but-theres-a-catch"><span>But there's a catch.</span></a></li><li><a href="#everything-is-going-according-to-plan"><span>Everything <wbr/>Is <wbr/>Going <wbr/>According to <wbr/>Plan</span></a></li><li><a href="#but-what-happens-if-the-news-forecast-doesnt-play-out"><span>But what happens if the news forecast doesn't play out?</span></a></li><li><a href="#source-code"><span>Source code</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">backtest-kit</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
documents/begin_02_getting_started_configuration.html
CHANGED
|
@@ -72,7 +72,7 @@
|
|
| 72 |
<p><img src="../media/02-getting-started-configuration_1.svg" alt="Mermaid Diagram"></p>
|
| 73 |
<hr>
|
| 74 |
<a id="verification" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Verification<a href="#verification" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>To ensure the environment is correctly configured, you can verify the framework initialization with a minimal script:</p>
|
| 75 |
-
<pre><code class="typescript"><span class="hl-
|
| 76 |
</code><button type="button">Copy</button></pre>
|
| 77 |
|
| 78 |
<p><strong>Expected Result:</strong> The console should indicate that 14 default parameters have been loaded.</p>
|
|
|
|
| 72 |
<p><img src="../media/02-getting-started-configuration_1.svg" alt="Mermaid Diagram"></p>
|
| 73 |
<hr>
|
| 74 |
<a id="verification" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Verification<a href="#verification" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>To ensure the environment is correctly configured, you can verify the framework initialization with a minimal script:</p>
|
| 75 |
+
<pre><code class="typescript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">getDefaultConfig</span><span class="hl-1">, </span><span class="hl-4">setLogger</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">'backtest-kit'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Verify Logger</span><br/><span class="hl-0">setLogger</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-0">log</span><span class="hl-4">:</span><span class="hl-1"> (</span><span class="hl-4">topic</span><span class="hl-1">, ...</span><span class="hl-4">args</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-4">topic</span><span class="hl-1">, </span><span class="hl-4">args</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-0">debug</span><span class="hl-4">:</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {},</span><br/><span class="hl-1"> </span><span class="hl-0">info</span><span class="hl-4">:</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {},</span><br/><span class="hl-1"> </span><span class="hl-0">warn</span><span class="hl-4">:</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {},</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-6">// Verify Configuration</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">config</span><span class="hl-1"> = </span><span class="hl-0">getDefaultConfig</span><span class="hl-1">();</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Parameters loaded:'</span><span class="hl-1">, </span><span class="hl-4">Object</span><span class="hl-1">.</span><span class="hl-0">keys</span><span class="hl-1">(</span><span class="hl-4">config</span><span class="hl-1">).</span><span class="hl-4">length</span><span class="hl-1">);</span>
|
| 76 |
</code><button type="button">Copy</button></pre>
|
| 77 |
|
| 78 |
<p><strong>Expected Result:</strong> The console should indicate that 14 default parameters have been loaded.</p>
|
documents/begin_12_backtest_module_frame_configuration.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
| 71 |
</ul>
|
| 72 |
<hr>
|
| 73 |
<a id="global-framework-overrides" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Global Framework Overrides<a href="#global-framework-overrides" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The module sets specific global configurations using <code>setConfig</code>.</p>
|
| 74 |
-
<pre><code class="typescript"><span class="hl-0">setConfig</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-
|
| 75 |
</code><button type="button">Copy</button></pre>
|
| 76 |
|
| 77 |
<p>By setting <code>CC_MAX_STOPLOSS_DISTANCE_PERCENT</code> to <code>100</code>, the strategy disables the default safety checks that would otherwise reject signals with very wide stop-losses. This is necessary for the <code>feb_2026_strategy</code> which may utilize wide stops or rely on logic-based exits (like sentiment flips) rather than tight technical stops.</p>
|
|
|
|
| 71 |
</ul>
|
| 72 |
<hr>
|
| 73 |
<a id="global-framework-overrides" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Global Framework Overrides<a href="#global-framework-overrides" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The module sets specific global configurations using <code>setConfig</code>.</p>
|
| 74 |
+
<pre><code class="typescript"><span class="hl-0">setConfig</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">CC_MAX_STOPLOSS_DISTANCE_PERCENT:</span><span class="hl-1"> </span><span class="hl-7">100</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
|
| 75 |
</code><button type="button">Copy</button></pre>
|
| 76 |
|
| 77 |
<p>By setting <code>CC_MAX_STOPLOSS_DISTANCE_PERCENT</code> to <code>100</code>, the strategy disables the default safety checks that would otherwise reject signals with very wide stop-losses. This is necessary for the <code>feb_2026_strategy</code> which may utilize wide stops or rely on logic-based exits (like sentiment flips) rather than tight technical stops.</p>
|
documents/begin_18_risk_management.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
<p><strong>Risk Logic Sequence</strong>
|
| 12 |
<img src="../media/18-risk-management_0.svg" alt="Mermaid Diagram"></p>
|
| 13 |
<a id="registering-risk-profiles" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Registering Risk Profiles<a href="#registering-risk-profiles" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Risk profiles are registered using the <code>addRisk()</code> function. Strategies link to these profiles by matching the <code>riskName</code> identifier.</p>
|
| 14 |
-
<pre><code class="typescript"><span class="hl-
|
| 15 |
</code><button type="button">Copy</button></pre>
|
| 16 |
|
| 17 |
<a id="risk-profile-schema" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Risk Profile Schema<a href="#risk-profile-schema" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><table>
|
|
@@ -89,19 +89,19 @@
|
|
| 89 |
</table>
|
| 90 |
<a id="built-in--custom-validators" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Built-in & Custom Validators<a href="#built-in--custom-validators" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The system supports diverse validation logic, ranging from simple count limits to complex temporal and multi-strategy checks.</p>
|
| 91 |
<a id="1-concurrent-position-limits" class="tsd-anchor"></a><h3 class="tsd-anchor-link">1. Concurrent Position Limits<a href="#1-concurrent-position-limits" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Limits the total number of open positions to manage capital exposure.</p>
|
| 92 |
-
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-
|
| 93 |
</code><button type="button">Copy</button></pre>
|
| 94 |
|
| 95 |
<a id="2-symbol-filtering" class="tsd-anchor"></a><h3 class="tsd-anchor-link">2. Symbol Filtering<a href="#2-symbol-filtering" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Prevents trading on specific instruments (e.g., blacklisting high-volatility assets).</p>
|
| 96 |
-
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-
|
| 97 |
</code><button type="button">Copy</button></pre>
|
| 98 |
|
| 99 |
<a id="3-trading-time-windows" class="tsd-anchor"></a><h3 class="tsd-anchor-link">3. Trading Time Windows<a href="#3-trading-time-windows" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Restricts activity to specific hours or days (e.g., avoiding weekend gaps or illiquid hours).</p>
|
| 100 |
-
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-
|
| 101 |
</code><button type="button">Copy</button></pre>
|
| 102 |
|
| 103 |
<a id="4-multi-strategy-coordination" class="tsd-anchor"></a><h3 class="tsd-anchor-link">4. Multi-Strategy Coordination<a href="#4-multi-strategy-coordination" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Ensures strategies do not "fight" over the same symbol or exceed per-strategy quotas.</p>
|
| 104 |
-
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-
|
| 105 |
</code><button type="button">Copy</button></pre>
|
| 106 |
|
| 107 |
<a id="rejection-events-risksubject" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Rejection Events (<code>riskSubject</code>)<a href="#rejection-events-risksubject" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>When a signal is rejected by the risk layer, an event is emitted to the <code>riskSubject</code>. This allows UI components or monitoring logs to display the specific reason for the trade failure without the strategy needing to handle the error internally.</p>
|
|
|
|
| 11 |
<p><strong>Risk Logic Sequence</strong>
|
| 12 |
<img src="../media/18-risk-management_0.svg" alt="Mermaid Diagram"></p>
|
| 13 |
<a id="registering-risk-profiles" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Registering Risk Profiles<a href="#registering-risk-profiles" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Risk profiles are registered using the <code>addRisk()</code> function. Strategies link to these profiles by matching the <code>riskName</code> identifier.</p>
|
| 14 |
+
<pre><code class="typescript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">addRisk</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><br/><span class="hl-0">addRisk</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">riskName:</span><span class="hl-1"> </span><span class="hl-2">"conservative"</span><span class="hl-1">, </span><span class="hl-6">// Unique identifier</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-2">"Conservative profile"</span><span class="hl-1">, </span><span class="hl-6">// Optional documentation</span><br/><span class="hl-1"> </span><span class="hl-4">validations:</span><span class="hl-1"> [ </span><span class="hl-6">// Array of validation rules</span><br/><span class="hl-1"> </span><span class="hl-6">// Validation logic here</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1"> </span><span class="hl-4">callbacks:</span><span class="hl-1"> { </span><span class="hl-6">// Optional event hooks</span><br/><span class="hl-1"> </span><span class="hl-0">onRejected</span><span class="hl-4">:</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">params</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> { </span><span class="hl-6">/* ... */</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-0">onAllowed</span><span class="hl-4">:</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">params</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> { </span><span class="hl-6">/* ... */</span><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1">});</span>
|
| 15 |
</code><button type="button">Copy</button></pre>
|
| 16 |
|
| 17 |
<a id="risk-profile-schema" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Risk Profile Schema<a href="#risk-profile-schema" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><table>
|
|
|
|
| 89 |
</table>
|
| 90 |
<a id="built-in--custom-validators" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Built-in & Custom Validators<a href="#built-in--custom-validators" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The system supports diverse validation logic, ranging from simple count limits to complex temporal and multi-strategy checks.</p>
|
| 91 |
<a id="1-concurrent-position-limits" class="tsd-anchor"></a><h3 class="tsd-anchor-link">1. Concurrent Position Limits<a href="#1-concurrent-position-limits" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Limits the total number of open positions to manage capital exposure.</p>
|
| 92 |
+
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-4">activePositionCount</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">activePositionCount</span><span class="hl-1"> >= </span><span class="hl-7">3</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">throw</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Error</span><span class="hl-1">(</span><span class="hl-2">"Maximum 3 concurrent positions reached"</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 93 |
</code><button type="button">Copy</button></pre>
|
| 94 |
|
| 95 |
<a id="2-symbol-filtering" class="tsd-anchor"></a><h3 class="tsd-anchor-link">2. Symbol Filtering<a href="#2-symbol-filtering" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Prevents trading on specific instruments (e.g., blacklisting high-volatility assets).</p>
|
| 96 |
+
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-4">symbol</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">restricted</span><span class="hl-1"> = [</span><span class="hl-2">"DOGEUSDT"</span><span class="hl-1">, </span><span class="hl-2">"PEPEUSDT"</span><span class="hl-1">];</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">restricted</span><span class="hl-1">.</span><span class="hl-0">includes</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">)) {</span><br/><span class="hl-1"> </span><span class="hl-5">throw</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Error</span><span class="hl-1">(</span><span class="hl-2">`Symbol </span><span class="hl-3">${</span><span class="hl-4">symbol</span><span class="hl-3">}</span><span class="hl-2"> is restricted`</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 97 |
</code><button type="button">Copy</button></pre>
|
| 98 |
|
| 99 |
<a id="3-trading-time-windows" class="tsd-anchor"></a><h3 class="tsd-anchor-link">3. Trading Time Windows<a href="#3-trading-time-windows" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Restricts activity to specific hours or days (e.g., avoiding weekend gaps or illiquid hours).</p>
|
| 100 |
+
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-4">timestamp</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">hour</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-4">timestamp</span><span class="hl-1">).</span><span class="hl-0">getUTCHours</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">hour</span><span class="hl-1"> < </span><span class="hl-7">9</span><span class="hl-1"> || </span><span class="hl-4">hour</span><span class="hl-1"> >= </span><span class="hl-7">17</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">throw</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Error</span><span class="hl-1">(</span><span class="hl-2">"Outside of business hours (9:00-17:00 UTC)"</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 101 |
</code><button type="button">Copy</button></pre>
|
| 102 |
|
| 103 |
<a id="4-multi-strategy-coordination" class="tsd-anchor"></a><h3 class="tsd-anchor-link">4. Multi-Strategy Coordination<a href="#4-multi-strategy-coordination" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Ensures strategies do not "fight" over the same symbol or exceed per-strategy quotas.</p>
|
| 104 |
+
<pre><code class="typescript"><span class="hl-1">({ </span><span class="hl-4">activePositions</span><span class="hl-1">, </span><span class="hl-4">strategyName</span><span class="hl-1">, </span><span class="hl-4">symbol</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">// Check if this symbol is already being traded by ANY strategy</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">duplicate</span><span class="hl-1"> = </span><span class="hl-4">activePositions</span><span class="hl-1">.</span><span class="hl-0">find</span><span class="hl-1">(</span><span class="hl-4">p</span><span class="hl-1"> </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">p</span><span class="hl-1">.</span><span class="hl-4">signal</span><span class="hl-1">.</span><span class="hl-4">symbol</span><span class="hl-1"> === </span><span class="hl-4">symbol</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">duplicate</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">throw</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Error</span><span class="hl-1">(</span><span class="hl-2">`</span><span class="hl-3">${</span><span class="hl-4">symbol</span><span class="hl-3">}</span><span class="hl-2"> already has a position via </span><span class="hl-3">${</span><span class="hl-4">duplicate</span><span class="hl-9">.</span><span class="hl-4">strategyName</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 105 |
</code><button type="button">Copy</button></pre>
|
| 106 |
|
| 107 |
<a id="rejection-events-risksubject" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Rejection Events (<code>riskSubject</code>)<a href="#rejection-events-risksubject" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>When a signal is rejected by the risk layer, an event is emitted to the <code>riskSubject</code>. This allows UI components or monitoring logs to display the specific reason for the trade failure without the strategy needing to handle the error internally.</p>
|
documents/begin_22_symbol_configuration.html
CHANGED
|
@@ -110,7 +110,7 @@
|
|
| 110 |
</li>
|
| 111 |
</ol>
|
| 112 |
<p><strong>Example Entry:</strong></p>
|
| 113 |
-
<pre><code class="javascript"><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-10">icon</span><span class="hl-1">: </span><span class="hl-2">"/icon/link.png"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">logo</span><span class="hl-1">: </span><span class="hl-2">"/icon/128/link.png"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">symbol</span><span class="hl-1">: </span><span class="hl-2">"LINKUSDT"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">color</span><span class="hl-1">: </span><span class="hl-2">"#375BD2"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">displayName</span><span class="hl-1">: </span><span class="hl-2">"Chainlink"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">priority</span><span class="hl-1">: </span><span class="hl-7">150</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">description</span><span class="hl-1">: </span><span class="hl-
|
| 114 |
</code><button type="button">Copy</button></pre>
|
| 115 |
|
| 116 |
<ul>
|
|
|
|
| 110 |
</li>
|
| 111 |
</ol>
|
| 112 |
<p><strong>Example Entry:</strong></p>
|
| 113 |
+
<pre><code class="javascript"><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-10">icon</span><span class="hl-1">: </span><span class="hl-2">"/icon/link.png"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">logo</span><span class="hl-1">: </span><span class="hl-2">"/icon/128/link.png"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">symbol</span><span class="hl-1">: </span><span class="hl-2">"LINKUSDT"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">color</span><span class="hl-1">: </span><span class="hl-2">"#375BD2"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">displayName</span><span class="hl-1">: </span><span class="hl-2">"Chainlink"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">priority</span><span class="hl-1">: </span><span class="hl-7">150</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">description</span><span class="hl-1">: </span><span class="hl-4">str</span><span class="hl-1">.</span><span class="hl-0">newline</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"Chainlink (LINK) - a decentralized oracle network"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">"Provides data transmission from the external world to smart contracts"</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1">}</span>
|
| 114 |
</code><button type="button">Copy</button></pre>
|
| 115 |
|
| 116 |
<ul>
|
documents/cli_readme.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
documents/demo_backtest_readme.html
CHANGED
|
@@ -42,10 +42,10 @@
|
|
| 42 |
<li><strong>Exchange</strong>: Binance via CCXT</li>
|
| 43 |
<li><strong>UUID</strong>: uuid for unique result tracking</li>
|
| 44 |
</ul>
|
| 45 |
-
<a id="project-structure" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Project Structure<a href="#project-structure" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code><span class="hl-
|
| 46 |
</code><button>Copy</button></pre>
|
| 47 |
|
| 48 |
-
<a id="installation-and-setup" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation and Setup<a href="#installation-and-setup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-6"># Navigate to project directory</span><br/><span class="hl-0">cd</span><span class="hl-1"> </span><span class="hl-2">demo/backtest</span><br/><br/><span class="hl-6"># Install dependencies</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><br/><br/><span class="hl-6"># Set environment variables</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-
|
| 49 |
</code><button type="button">Copy</button></pre>
|
| 50 |
|
| 51 |
<a id="configuration" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="environment-variables" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Environment Variables<a href="#environment-variables" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Create a <code>.env</code> file or set environment variables:</p>
|
|
@@ -99,7 +99,7 @@
|
|
| 99 |
</code><button type="button">Copy</button></pre>
|
| 100 |
|
| 101 |
<p>Output:</p>
|
| 102 |
-
<pre><code><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">25.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">360</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">50.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">720</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">75.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">1080</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">100.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">1440</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-
|
| 103 |
</code><button>Copy</button></pre>
|
| 104 |
|
| 105 |
<p>Generated files:</p>
|
|
@@ -126,15 +126,15 @@
|
|
| 126 |
</code><button type="button">Copy</button></pre>
|
| 127 |
|
| 128 |
<a id="debugging-llm-conversations" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Debugging LLM Conversations<a href="#debugging-llm-conversations" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Each signal generates debug logs in <code>./dump/strategy/{uuid}/</code>:</p>
|
| 129 |
-
<pre><code><span class="hl-1">./</span><span class="hl-
|
| 130 |
</code><button>Copy</button></pre>
|
| 131 |
|
| 132 |
<a id="customizing-symbols" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Customizing Symbols<a href="#customizing-symbols" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Modify <code>src/index.mjs</code> to analyze different cryptocurrencies:</p>
|
| 133 |
-
<pre><code class="javascript"><span class="hl-
|
| 134 |
</code><button type="button">Copy</button></pre>
|
| 135 |
|
| 136 |
<a id="adjusting-time-periods" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adjusting Time Periods<a href="#adjusting-time-periods" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Edit backtest period in <code>src/index.mjs</code>:</p>
|
| 137 |
-
<pre><code class="javascript"><span class="hl-0">addFrame</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-
|
| 138 |
</code><button type="button">Copy</button></pre>
|
| 139 |
|
| 140 |
<a id="how-it-works" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How It Works<a href="#how-it-works" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="phase-1-multi-timeframe-data-collection" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Phase 1: Multi-Timeframe Data Collection<a href="#phase-1-multi-timeframe-data-collection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>For each signal generation (every 5 minutes):</p>
|
|
@@ -195,7 +195,7 @@
|
|
| 195 |
<li>Risk-aware position sizing</li>
|
| 196 |
</ul>
|
| 197 |
<a id="user-prompt-strategy" class="tsd-anchor"></a><h3 class="tsd-anchor-link">User Prompt Strategy<a href="#user-prompt-strategy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Final request emphasizes caution:</p>
|
| 198 |
-
<pre><code><span class="hl-
|
| 199 |
</code><button>Copy</button></pre>
|
| 200 |
|
| 201 |
<p>This prevents:</p>
|
|
@@ -224,27 +224,27 @@
|
|
| 224 |
<li><strong>Risk Management</strong>: Strict TP/SL validation and position sizing</li>
|
| 225 |
<li><strong>Time Efficiency</strong>: Seconds vs. hours of manual chart analysis</li>
|
| 226 |
</ul>
|
| 227 |
-
<a id="advanced-customization" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Advanced Customization<a href="#advanced-customization" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="adding-new-timeframes" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adding New Timeframes<a href="#adding-new-timeframes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In utils/messages.mjs</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">longTermCandles</span><span class="hl-1"> = </span><span class="hl-
|
| 228 |
</code><button type="button">Copy</button></pre>
|
| 229 |
|
| 230 |
-
<a id="changing-llm-model" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Changing LLM Model<a href="#changing-llm-model" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In utils/json.mjs</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">response</span><span class="hl-1"> = </span><span class="hl-
|
| 231 |
</code><button type="button">Copy</button></pre>
|
| 232 |
|
| 233 |
<a id="custom-signal-schema" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Custom Signal Schema<a href="#custom-signal-schema" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In utils/json.mjs - modify format property</span><br/><span class="hl-10">format</span><span class="hl-1">: {</span><br/><span class="hl-1"> </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"object"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">properties</span><span class="hl-1">: {</span><br/><span class="hl-1"> </span><span class="hl-10">position</span><span class="hl-1">: { </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"string"</span><span class="hl-1">, </span><span class="hl-10">enum</span><span class="hl-1">: [</span><span class="hl-2">"wait"</span><span class="hl-1">, </span><span class="hl-2">"long"</span><span class="hl-1">, </span><span class="hl-2">"short"</span><span class="hl-1">] },</span><br/><span class="hl-1"> </span><span class="hl-10">note</span><span class="hl-1">: { </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"string"</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-10">confidence</span><span class="hl-1">: { </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"number"</span><span class="hl-1">, </span><span class="hl-10">minimum</span><span class="hl-1">: </span><span class="hl-7">0</span><span class="hl-1">, </span><span class="hl-10">maximum</span><span class="hl-1">: </span><span class="hl-7">1</span><span class="hl-1"> }, </span><span class="hl-6">// Add confidence</span><br/><span class="hl-1"> </span><span class="hl-6">// ... existing fields</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 234 |
</code><button type="button">Copy</button></pre>
|
| 235 |
|
| 236 |
-
<a id="custom-event-handlers" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Custom Event Handlers<a href="#custom-event-handlers" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In src/index.mjs</span><br/><span class="hl-0">listenSignalBacktest</span><span class="hl-1">((</span><span class="hl-
|
| 237 |
</code><button type="button">Copy</button></pre>
|
| 238 |
|
| 239 |
-
<a id="parallel-backtesting" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Parallel Backtesting<a href="#parallel-backtesting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// Test multiple symbols simultaneously</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">symbols</span><span class="hl-1"> = [</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"ETHUSDT"</span><span class="hl-1">, </span><span class="hl-2">"SOLUSDT"</span><span class="hl-1">];</span><br/><br/><span class="hl-
|
| 240 |
</code><button type="button">Copy</button></pre>
|
| 241 |
|
| 242 |
<a id="troubleshooting" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Troubleshooting<a href="#troubleshooting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="common-issues" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Common Issues<a href="#common-issues" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p><strong>Issue</strong>: <code>OLLAMA_API_KEY is not defined</code></p>
|
| 243 |
-
<pre><code class="bash"><span class="hl-6"># Solution: Set environment variable</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-
|
| 244 |
</code><button type="button">Copy</button></pre>
|
| 245 |
|
| 246 |
<p><strong>Issue</strong>: <code>Rate limit exceeded</code></p>
|
| 247 |
-
<pre><code class="javascript"><span class="hl-6">// Solution: Add delay between requests in utils/json.mjs</span><br/><span class="hl-
|
| 248 |
</code><button type="button">Copy</button></pre>
|
| 249 |
|
| 250 |
<p><strong>Issue</strong>: <code>Invalid signal structure</code></p>
|
|
|
|
| 42 |
<li><strong>Exchange</strong>: Binance via CCXT</li>
|
| 43 |
<li><strong>UUID</strong>: uuid for unique result tracking</li>
|
| 44 |
</ul>
|
| 45 |
+
<a id="project-structure" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Project Structure<a href="#project-structure" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code><span class="hl-4">demo</span><span class="hl-1">/</span><span class="hl-4">backtest</span><span class="hl-1">/</span><br/><span class="hl-1">├── </span><span class="hl-4">src</span><span class="hl-1">/</span><br/><span class="hl-1">│ ├── </span><span class="hl-4">index</span><span class="hl-1">.</span><span class="hl-4">mjs</span><span class="hl-1"> # </span><span class="hl-4">Main</span><span class="hl-1"> </span><span class="hl-4">backtest</span><span class="hl-1"> </span><span class="hl-4">configuration</span><br/><span class="hl-1">│ └── </span><span class="hl-4">utils</span><span class="hl-1">/</span><br/><span class="hl-1">│ ├── </span><span class="hl-4">json</span><span class="hl-1">.</span><span class="hl-4">mjs</span><span class="hl-1"> # </span><span class="hl-8">LLM</span><span class="hl-1"> </span><span class="hl-8">API</span><span class="hl-1"> </span><span class="hl-0">client</span><span class="hl-1"> (</span><span class="hl-4">Ollama</span><span class="hl-1">)</span><br/><span class="hl-1">│ └── </span><span class="hl-4">messages</span><span class="hl-1">.</span><span class="hl-4">mjs</span><span class="hl-1"> # </span><span class="hl-4">Multi</span><span class="hl-1">-</span><span class="hl-4">timeframe</span><span class="hl-1"> </span><span class="hl-4">message</span><span class="hl-1"> </span><span class="hl-4">builder</span><br/><span class="hl-1">├── </span><span class="hl-4">package</span><span class="hl-1">.</span><span class="hl-4">json</span><span class="hl-1"> # </span><span class="hl-4">Dependencies</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">scripts</span><br/><span class="hl-1">└── </span><span class="hl-8">README</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-4">This</span><span class="hl-1"> </span><span class="hl-4">file</span>
|
| 46 |
</code><button>Copy</button></pre>
|
| 47 |
|
| 48 |
+
<a id="installation-and-setup" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation and Setup<a href="#installation-and-setup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-6"># Navigate to project directory</span><br/><span class="hl-0">cd</span><span class="hl-1"> </span><span class="hl-2">demo/backtest</span><br/><br/><span class="hl-6"># Install dependencies</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><br/><br/><span class="hl-6"># Set environment variables</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-4">OLLAMA_API_KEY</span><span class="hl-1">=</span><span class="hl-4">your_ollama_api_key</span><br/><br/><span class="hl-6"># Run backtest</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">start</span>
|
| 49 |
</code><button type="button">Copy</button></pre>
|
| 50 |
|
| 51 |
<a id="configuration" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="environment-variables" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Environment Variables<a href="#environment-variables" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Create a <code>.env</code> file or set environment variables:</p>
|
|
|
|
| 99 |
</code><button type="button">Copy</button></pre>
|
| 100 |
|
| 101 |
<p>Output:</p>
|
| 102 |
+
<pre><code><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">25.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">360</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">50.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">720</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">75.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">1080</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-10">Progress</span><span class="hl-1">: </span><span class="hl-7">100.00</span><span class="hl-1">%</span><br/><span class="hl-10">Processed</span><span class="hl-1">: </span><span class="hl-7">1440</span><span class="hl-1"> / </span><span class="hl-7">1440</span><br/><span class="hl-4">Backtest</span><span class="hl-1"> </span><span class="hl-10">completed</span><span class="hl-1">: </span><span class="hl-8">BTCUSDT</span>
|
| 103 |
</code><button>Copy</button></pre>
|
| 104 |
|
| 105 |
<p>Generated files:</p>
|
|
|
|
| 126 |
</code><button type="button">Copy</button></pre>
|
| 127 |
|
| 128 |
<a id="debugging-llm-conversations" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Debugging LLM Conversations<a href="#debugging-llm-conversations" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Each signal generates debug logs in <code>./dump/strategy/{uuid}/</code>:</p>
|
| 129 |
+
<pre><code><span class="hl-1">./</span><span class="hl-4">dump</span><span class="hl-1">/</span><span class="hl-4">strategy</span><span class="hl-1">/</span><span class="hl-4">a1b2c3d4</span><span class="hl-1">-</span><span class="hl-4">e5f6</span><span class="hl-1">-</span><span class="hl-7">7890</span><span class="hl-1">-</span><span class="hl-4">abcd</span><span class="hl-1">-</span><span class="hl-4">ef1234567890</span><span class="hl-1">/</span><br/><span class="hl-1">├── 00</span><span class="hl-4">_system_prompt</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-4">System</span><span class="hl-1"> </span><span class="hl-4">instructions</span><br/><span class="hl-1">├── 01</span><span class="hl-4">_user_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # 1</span><span class="hl-4">h</span><span class="hl-1"> </span><span class="hl-4">candles</span><span class="hl-1"> </span><span class="hl-4">analysis</span><br/><span class="hl-1">├── 02</span><span class="hl-4">_assistant_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-8">LLM</span><span class="hl-1"> </span><span class="hl-4">acknowledgment</span><br/><span class="hl-1">├── 03</span><span class="hl-4">_user_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # 15</span><span class="hl-4">m</span><span class="hl-1"> </span><span class="hl-4">candles</span><span class="hl-1"> </span><span class="hl-4">analysis</span><br/><span class="hl-1">├── 04</span><span class="hl-4">_assistant_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-8">LLM</span><span class="hl-1"> </span><span class="hl-4">acknowledgment</span><br/><span class="hl-1">├── 05</span><span class="hl-4">_user_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # 5</span><span class="hl-4">m</span><span class="hl-1"> </span><span class="hl-4">candles</span><span class="hl-1"> </span><span class="hl-4">analysis</span><br/><span class="hl-1">├── 06</span><span class="hl-4">_assistant_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-8">LLM</span><span class="hl-1"> </span><span class="hl-4">acknowledgment</span><br/><span class="hl-1">├── 07</span><span class="hl-4">_user_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # 1</span><span class="hl-4">m</span><span class="hl-1"> </span><span class="hl-4">candles</span><span class="hl-1"> </span><span class="hl-4">analysis</span><br/><span class="hl-1">├── 08</span><span class="hl-4">_assistant_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-8">LLM</span><span class="hl-1"> </span><span class="hl-4">acknowledgment</span><br/><span class="hl-1">├── 09</span><span class="hl-4">_user_message</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-4">Signal</span><span class="hl-1"> </span><span class="hl-4">generation</span><span class="hl-1"> </span><span class="hl-4">request</span><br/><span class="hl-1">└── 10</span><span class="hl-4">_llm_output</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-4">Final</span><span class="hl-1"> </span><span class="hl-4">signal</span><span class="hl-1"> </span><span class="hl-5">with</span><span class="hl-1"> </span><span class="hl-8">JSON</span>
|
| 130 |
</code><button>Copy</button></pre>
|
| 131 |
|
| 132 |
<a id="customizing-symbols" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Customizing Symbols<a href="#customizing-symbols" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Modify <code>src/index.mjs</code> to analyze different cryptocurrencies:</p>
|
| 133 |
+
<pre><code class="javascript"><span class="hl-4">Backtest</span><span class="hl-1">.</span><span class="hl-0">background</span><span class="hl-1">(</span><span class="hl-2">"ETHUSDT"</span><span class="hl-1">, { </span><span class="hl-6">// Change symbol</span><br/><span class="hl-1"> </span><span class="hl-4">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"test_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"test_exchange"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">frameName:</span><span class="hl-1"> </span><span class="hl-2">"test_frame"</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
|
| 134 |
</code><button type="button">Copy</button></pre>
|
| 135 |
|
| 136 |
<a id="adjusting-time-periods" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adjusting Time Periods<a href="#adjusting-time-periods" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Edit backtest period in <code>src/index.mjs</code>:</p>
|
| 137 |
+
<pre><code class="javascript"><span class="hl-0">addFrame</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">frameName:</span><span class="hl-1"> </span><span class="hl-2">"test_frame"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">interval:</span><span class="hl-1"> </span><span class="hl-2">"1m"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">startDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2025-12-15T00:00:00.000Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-4">endDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2025-12-15T23:59:59.000Z"</span><span class="hl-1">),</span><br/><span class="hl-1">});</span>
|
| 138 |
</code><button type="button">Copy</button></pre>
|
| 139 |
|
| 140 |
<a id="how-it-works" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How It Works<a href="#how-it-works" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="phase-1-multi-timeframe-data-collection" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Phase 1: Multi-Timeframe Data Collection<a href="#phase-1-multi-timeframe-data-collection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>For each signal generation (every 5 minutes):</p>
|
|
|
|
| 195 |
<li>Risk-aware position sizing</li>
|
| 196 |
</ul>
|
| 197 |
<a id="user-prompt-strategy" class="tsd-anchor"></a><h3 class="tsd-anchor-link">User Prompt Strategy<a href="#user-prompt-strategy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Final request emphasizes caution:</p>
|
| 198 |
+
<pre><code><span class="hl-4">Проанализируй</span><span class="hl-1"> </span><span class="hl-4">все</span><span class="hl-1"> </span><span class="hl-4">таймфреймы</span><span class="hl-1"> </span><span class="hl-4">и</span><span class="hl-1"> </span><span class="hl-4">сгенерируй</span><span class="hl-1"> </span><span class="hl-4">торговый</span><span class="hl-1"> </span><span class="hl-4">сигнал</span><span class="hl-1">.</span><br/><span class="hl-4">Открывай</span><span class="hl-1"> </span><span class="hl-4">позицию</span><span class="hl-1"> </span><span class="hl-8">ТОЛЬКО</span><span class="hl-1"> </span><span class="hl-4">при</span><span class="hl-1"> </span><span class="hl-4">четком</span><span class="hl-1"> </span><span class="hl-4">сигнале</span><span class="hl-1">.</span><br/><br/><span class="hl-4">Если</span><span class="hl-1"> </span><span class="hl-4">сигналы</span><span class="hl-1"> </span><span class="hl-4">противоречивы</span><span class="hl-1"> </span><span class="hl-4">или</span><span class="hl-1"> </span><span class="hl-4">тренд</span><span class="hl-1"> </span><span class="hl-4">слабый</span><span class="hl-1"> </span><span class="hl-4">то</span><span class="hl-1"> </span><span class="hl-10">position</span><span class="hl-1">: </span><span class="hl-4">wait</span>
|
| 199 |
</code><button>Copy</button></pre>
|
| 200 |
|
| 201 |
<p>This prevents:</p>
|
|
|
|
| 224 |
<li><strong>Risk Management</strong>: Strict TP/SL validation and position sizing</li>
|
| 225 |
<li><strong>Time Efficiency</strong>: Seconds vs. hours of manual chart analysis</li>
|
| 226 |
</ul>
|
| 227 |
+
<a id="advanced-customization" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Advanced Customization<a href="#advanced-customization" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="adding-new-timeframes" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adding New Timeframes<a href="#adding-new-timeframes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In utils/messages.mjs</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">longTermCandles</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-2">"4h"</span><span class="hl-1">, </span><span class="hl-7">24</span><span class="hl-1">);</span><br/><br/><span class="hl-4">messages</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">(</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">role:</span><span class="hl-1"> </span><span class="hl-2">"user"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">content:</span><span class="hl-1"> </span><span class="hl-2">`Проанализируй свечи 4h:</span><span class="hl-13">\n</span><span class="hl-3">${</span><span class="hl-0">formatCandles</span><span class="hl-9">(</span><span class="hl-4">longTermCandles</span><span class="hl-9">, </span><span class="hl-2">"4h"</span><span class="hl-9">)</span><span class="hl-3">}</span><span class="hl-2">`</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">role:</span><span class="hl-1"> </span><span class="hl-2">"assistant"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">content:</span><span class="hl-1"> </span><span class="hl-2">"Долгосрочный тренд 4h проанализирован"</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">);</span>
|
| 228 |
</code><button type="button">Copy</button></pre>
|
| 229 |
|
| 230 |
+
<a id="changing-llm-model" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Changing LLM Model<a href="#changing-llm-model" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In utils/json.mjs</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">response</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">ollama</span><span class="hl-1">.</span><span class="hl-0">chat</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> </span><span class="hl-2">"llama3.3:70b"</span><span class="hl-1">, </span><span class="hl-6">// Use different model</span><br/><span class="hl-1"> </span><span class="hl-4">messages:</span><span class="hl-1"> [...]</span><br/><span class="hl-1">});</span>
|
| 231 |
</code><button type="button">Copy</button></pre>
|
| 232 |
|
| 233 |
<a id="custom-signal-schema" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Custom Signal Schema<a href="#custom-signal-schema" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In utils/json.mjs - modify format property</span><br/><span class="hl-10">format</span><span class="hl-1">: {</span><br/><span class="hl-1"> </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"object"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-10">properties</span><span class="hl-1">: {</span><br/><span class="hl-1"> </span><span class="hl-10">position</span><span class="hl-1">: { </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"string"</span><span class="hl-1">, </span><span class="hl-10">enum</span><span class="hl-1">: [</span><span class="hl-2">"wait"</span><span class="hl-1">, </span><span class="hl-2">"long"</span><span class="hl-1">, </span><span class="hl-2">"short"</span><span class="hl-1">] },</span><br/><span class="hl-1"> </span><span class="hl-10">note</span><span class="hl-1">: { </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"string"</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-10">confidence</span><span class="hl-1">: { </span><span class="hl-10">type</span><span class="hl-1">: </span><span class="hl-2">"number"</span><span class="hl-1">, </span><span class="hl-10">minimum</span><span class="hl-1">: </span><span class="hl-7">0</span><span class="hl-1">, </span><span class="hl-10">maximum</span><span class="hl-1">: </span><span class="hl-7">1</span><span class="hl-1"> }, </span><span class="hl-6">// Add confidence</span><br/><span class="hl-1"> </span><span class="hl-6">// ... existing fields</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 234 |
</code><button type="button">Copy</button></pre>
|
| 235 |
|
| 236 |
+
<a id="custom-event-handlers" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Custom Event Handlers<a href="#custom-event-handlers" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// In src/index.mjs</span><br/><span class="hl-0">listenSignalBacktest</span><span class="hl-1">((</span><span class="hl-4">event</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">event</span><span class="hl-1">.</span><span class="hl-4">action</span><span class="hl-1"> === </span><span class="hl-2">"opened"</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`📈 Opened </span><span class="hl-3">${</span><span class="hl-4">event</span><span class="hl-9">.</span><span class="hl-4">signal</span><span class="hl-9">.</span><span class="hl-4">position</span><span class="hl-3">}</span><span class="hl-2"> at </span><span class="hl-3">${</span><span class="hl-4">event</span><span class="hl-9">.</span><span class="hl-4">signal</span><span class="hl-9">.</span><span class="hl-4">priceOpen</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">);</span><br/><span class="hl-1"> } </span><span class="hl-5">else</span><span class="hl-1"> </span><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">event</span><span class="hl-1">.</span><span class="hl-4">action</span><span class="hl-1"> === </span><span class="hl-2">"closed"</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`💰 Closed with PNL: </span><span class="hl-3">${</span><span class="hl-4">event</span><span class="hl-9">.</span><span class="hl-4">pnl</span><span class="hl-9">.</span><span class="hl-4">pnlPercentage</span><span class="hl-9">.</span><span class="hl-0">toFixed</span><span class="hl-9">(</span><span class="hl-7">2</span><span class="hl-9">)</span><span class="hl-3">}</span><span class="hl-2">%`</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span>
|
| 237 |
</code><button type="button">Copy</button></pre>
|
| 238 |
|
| 239 |
+
<a id="parallel-backtesting" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Parallel Backtesting<a href="#parallel-backtesting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-6">// Test multiple symbols simultaneously</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">symbols</span><span class="hl-1"> = [</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"ETHUSDT"</span><span class="hl-1">, </span><span class="hl-2">"SOLUSDT"</span><span class="hl-1">];</span><br/><br/><span class="hl-5">for</span><span class="hl-1"> (</span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">symbol</span><span class="hl-1"> </span><span class="hl-3">of</span><span class="hl-1"> </span><span class="hl-4">symbols</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">Backtest</span><span class="hl-1">.</span><span class="hl-0">background</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">strategyName:</span><span class="hl-1"> </span><span class="hl-2">"test_strategy"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"test_exchange"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">frameName:</span><span class="hl-1"> </span><span class="hl-2">"test_frame"</span><span class="hl-1">,</span><br/><span class="hl-1"> });</span><br/><span class="hl-1">}</span>
|
| 240 |
</code><button type="button">Copy</button></pre>
|
| 241 |
|
| 242 |
<a id="troubleshooting" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Troubleshooting<a href="#troubleshooting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="common-issues" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Common Issues<a href="#common-issues" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p><strong>Issue</strong>: <code>OLLAMA_API_KEY is not defined</code></p>
|
| 243 |
+
<pre><code class="bash"><span class="hl-6"># Solution: Set environment variable</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-4">OLLAMA_API_KEY</span><span class="hl-1">=</span><span class="hl-4">your_key</span>
|
| 244 |
</code><button type="button">Copy</button></pre>
|
| 245 |
|
| 246 |
<p><strong>Issue</strong>: <code>Rate limit exceeded</code></p>
|
| 247 |
+
<pre><code class="javascript"><span class="hl-6">// Solution: Add delay between requests in utils/json.mjs</span><br/><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-11">Promise</span><span class="hl-1">(</span><span class="hl-4">resolve</span><span class="hl-1"> </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-0">setTimeout</span><span class="hl-1">(</span><span class="hl-4">resolve</span><span class="hl-1">, </span><span class="hl-7">1000</span><span class="hl-1">));</span>
|
| 248 |
</code><button type="button">Copy</button></pre>
|
| 249 |
|
| 250 |
<p><strong>Issue</strong>: <code>Invalid signal structure</code></p>
|
documents/demo_exchange_readme.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
| 29 |
<li><strong>Volatility</strong>: garch (GARCH/EGARCH/GJR-GARCH/HAR-RV/NoVaS auto-selection)</li>
|
| 30 |
<li><strong>Anomaly Detection</strong>: volume-anomaly (Hawkes + CUSUM + BOCD ensemble)</li>
|
| 31 |
</ul>
|
| 32 |
-
<a id="project-structure" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Project Structure<a href="#project-structure" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code><span class="hl-
|
| 33 |
</code><button>Copy</button></pre>
|
| 34 |
|
| 35 |
<a id="installation-and-setup" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation and Setup<a href="#installation-and-setup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-6"># Navigate to project directory</span><br/><span class="hl-0">cd</span><span class="hl-1"> </span><span class="hl-2">demo/ccxt</span><br/><br/><span class="hl-6"># Install dependencies</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><br/><br/><span class="hl-6"># Run the demo</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">start</span>
|
|
@@ -40,39 +40,39 @@
|
|
| 40 |
</code><button type="button">Copy</button></pre>
|
| 41 |
|
| 42 |
<p>Output:</p>
|
| 43 |
-
<pre><code class="javascript"><span class="hl-6">// 1. Last 5 candles (1m)</span><br/><span class="hl-1">[</span><br/><span class="hl-1"> { </span><span class="hl-
|
| 44 |
</code><button type="button">Copy</button></pre>
|
| 45 |
|
| 46 |
<a id="reusing-the-schema-in-your-project" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Reusing the Schema in Your Project<a href="#reusing-the-schema-in-your-project" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Copy <code>addExchangeSchema</code> block from <code>src/index.mjs</code> into your own strategy file and reference it by name:</p>
|
| 47 |
-
<pre><code class="javascript"><span class="hl-
|
| 48 |
</code><button type="button">Copy</button></pre>
|
| 49 |
|
| 50 |
<a id="customizing-the-exchange" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Customizing the Exchange<a href="#customizing-the-exchange" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Replace <code>ccxt.binance</code> with any other CCXT-supported exchange:</p>
|
| 51 |
-
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-
|
| 52 |
</code><button type="button">Copy</button></pre>
|
| 53 |
|
| 54 |
<a id="how-it-works" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How It Works<a href="#how-it-works" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="exchange-initialization" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Exchange Initialization<a href="#exchange-initialization" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>A single Binance spot instance is created lazily via <code>singleshot</code> and reused across all calls:</p>
|
| 55 |
-
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getExchange</span><span class="hl-1"> = </span><span class="hl-0">singleshot</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-
|
| 56 |
</code><button type="button">Copy</button></pre>
|
| 57 |
|
| 58 |
<a id="price--quantity-formatting" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Price / Quantity Formatting<a href="#price--quantity-formatting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Uses market <code>limits</code> (tick size / step size) with <code>roundTicks</code> fallback to CCXT precision methods:</p>
|
| 59 |
-
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tickSize</span><span class="hl-1"> = </span><span class="hl-
|
| 60 |
</code><button type="button">Copy</button></pre>
|
| 61 |
|
| 62 |
<a id="order-book" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Order Book<a href="#order-book" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Returns normalized <code>{ asks, bids }</code> arrays with string price/quantity. Throws in backtest mode — implement your own snapshot replay if needed.</p>
|
| 63 |
<a id="aggregated-trades" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Aggregated Trades<a href="#aggregated-trades" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Uses Binance-specific <code>publicGetAggTrades</code> endpoint with <code>startTime</code>/<code>endTime</code> window.</p>
|
| 64 |
<a id="volume-anomaly-getexecutedtradesskew" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Volume Anomaly (<code>getExecutedTradesSkew</code>)<a href="#volume-anomaly-getexecutedtradesskew" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Fetches <code>N_TRAIN + N_DETECT</code> (1 400) aggregated trades and splits them into a calibration baseline and a detection window with no overlap:</p>
|
| 65 |
-
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">all</span><span class="hl-1"> = </span><span class="hl-
|
| 66 |
</code><button type="button">Copy</button></pre>
|
| 67 |
|
| 68 |
<p>Returns <code>{ anomaly, confidence, direction, imbalance }</code>.</p>
|
| 69 |
<a id="volatility-forecast-getvolatilityforecast" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Volatility Forecast (<code>getVolatilityForecast</code>)<a href="#volatility-forecast-getvolatilityforecast" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Fetches candles across 8 timeframes (1m, 5m, 15m, 30m, 1h, 4h, 6h, 8h) and runs <code>garch.predict()</code> on each. Returns per-timeframe <code>{ sigma, reliable }</code> pairs grouped by interval:</p>
|
| 70 |
-
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-
|
| 71 |
</code><button type="button">Copy</button></pre>
|
| 72 |
|
| 73 |
<a id="analysis-libraries" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Analysis Libraries<a href="#analysis-libraries" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The aggregated trades and candles fetched via this exchange schema are used directly in the two companion analysis functions above.</p>
|
| 74 |
<a id="garch--volatility-forecasting" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code>garch</code> — Volatility Forecasting<a href="#garch--volatility-forecasting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Forecasts the expected price range for the next candle(s) using realized GARCH-family models. Auto-selects the best model (GARCH, EGARCH, GJR-GARCH, HAR-RV, NoVaS) by QLIKE error comparison.</p>
|
| 75 |
-
<pre><code class="javascript"><span class="hl-
|
| 76 |
</code><button type="button">Copy</button></pre>
|
| 77 |
|
| 78 |
<p>Use <code>predictRange(candles, interval, steps)</code> for multi-candle swing trade corridors. Use <code>backtest(candles, interval)</code> for walk-forward validation of model accuracy.</p>
|
|
@@ -106,7 +106,7 @@
|
|
| 106 |
<p>See the <a href="https://www.npmjs.com/package/garch">garch npm page</a> for the full API reference.</p>
|
| 107 |
<hr>
|
| 108 |
<a id="volume-anomaly--trade-flow-anomaly-detection" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code>volume-anomaly</code> — Trade Flow Anomaly Detection<a href="#volume-anomaly--trade-flow-anomaly-detection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Detects abnormal surges in trade flow from a raw stream of aggregated trades. Three independent detectors run in parallel (Hawkes Process, CUSUM, Bayesian Online Changepoint Detection) and combine into a single <code>confidence</code> score.</p>
|
| 109 |
-
<pre><code class="javascript"><span class="hl-
|
| 110 |
</code><button type="button">Copy</button></pre>
|
| 111 |
|
| 112 |
<blockquote>
|
|
|
|
| 29 |
<li><strong>Volatility</strong>: garch (GARCH/EGARCH/GJR-GARCH/HAR-RV/NoVaS auto-selection)</li>
|
| 30 |
<li><strong>Anomaly Detection</strong>: volume-anomaly (Hawkes + CUSUM + BOCD ensemble)</li>
|
| 31 |
</ul>
|
| 32 |
+
<a id="project-structure" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Project Structure<a href="#project-structure" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code><span class="hl-4">demo</span><span class="hl-1">/</span><span class="hl-4">ccxt</span><span class="hl-1">/</span><br/><span class="hl-1">├── </span><span class="hl-4">src</span><span class="hl-1">/</span><br/><span class="hl-1">│ └── </span><span class="hl-4">index</span><span class="hl-1">.</span><span class="hl-4">mjs</span><span class="hl-1"> # </span><span class="hl-4">Exchange</span><span class="hl-1"> </span><span class="hl-4">schema</span><span class="hl-1">, </span><span class="hl-4">volatility</span><span class="hl-1"> </span><span class="hl-4">forecast</span><span class="hl-1">, </span><span class="hl-4">anomaly</span><span class="hl-1"> </span><span class="hl-4">detection</span><span class="hl-1">, </span><span class="hl-4">smoke</span><span class="hl-1"> </span><span class="hl-4">tests</span><br/><span class="hl-1">├── </span><span class="hl-4">package</span><span class="hl-1">.</span><span class="hl-4">json</span><span class="hl-1"> # </span><span class="hl-4">Dependencies</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">scripts</span><br/><span class="hl-1">└── </span><span class="hl-8">README</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-4">This</span><span class="hl-1"> </span><span class="hl-4">file</span>
|
| 33 |
</code><button>Copy</button></pre>
|
| 34 |
|
| 35 |
<a id="installation-and-setup" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation and Setup<a href="#installation-and-setup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-6"># Navigate to project directory</span><br/><span class="hl-0">cd</span><span class="hl-1"> </span><span class="hl-2">demo/ccxt</span><br/><br/><span class="hl-6"># Install dependencies</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><br/><br/><span class="hl-6"># Run the demo</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">start</span>
|
|
|
|
| 40 |
</code><button type="button">Copy</button></pre>
|
| 41 |
|
| 42 |
<p>Output:</p>
|
| 43 |
+
<pre><code class="javascript"><span class="hl-6">// 1. Last 5 candles (1m)</span><br/><span class="hl-1">[</span><br/><span class="hl-1"> { </span><span class="hl-4">timestamp:</span><span class="hl-1"> ..., </span><span class="hl-4">open:</span><span class="hl-1"> ..., </span><span class="hl-4">high:</span><span class="hl-1"> ..., </span><span class="hl-4">low:</span><span class="hl-1"> ..., </span><span class="hl-4">close:</span><span class="hl-1"> ..., </span><span class="hl-4">volume:</span><span class="hl-1"> ... },</span><br/><span class="hl-1"> ...</span><br/><span class="hl-1">]</span><br/><br/><span class="hl-6">// 2. Volume anomaly skew from aggregated trades</span><br/><span class="hl-1">{ </span><span class="hl-10">anomaly</span><span class="hl-1">: </span><span class="hl-3">true</span><span class="hl-1">, </span><span class="hl-10">confidence</span><span class="hl-1">: </span><span class="hl-7">0.83</span><span class="hl-1">, </span><span class="hl-10">direction</span><span class="hl-1">: </span><span class="hl-2">'long'</span><span class="hl-1">, </span><span class="hl-10">imbalance</span><span class="hl-1">: </span><span class="hl-7">0.61</span><span class="hl-1"> }</span><br/><br/><span class="hl-6">// 3. Multi-timeframe volatility forecast</span><br/><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-10">volatility_1m</span><span class="hl-1">: { </span><span class="hl-10">sigma_1m</span><span class="hl-1">: </span><span class="hl-7">0.0004</span><span class="hl-1">, </span><span class="hl-10">reliable_1m</span><span class="hl-1">: </span><span class="hl-3">true</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-10">volatility_5m</span><span class="hl-1">: { </span><span class="hl-10">sigma_5m</span><span class="hl-1">: </span><span class="hl-7">0.0009</span><span class="hl-1">, </span><span class="hl-10">reliable_5m</span><span class="hl-1">: </span><span class="hl-3">true</span><span class="hl-1"> },</span><br/><span class="hl-1"> ...</span><br/><span class="hl-1"> </span><span class="hl-10">volatility_8h</span><span class="hl-1">: { </span><span class="hl-10">sigma_8h</span><span class="hl-1">: </span><span class="hl-7">0.031</span><span class="hl-1">, </span><span class="hl-10">reliable_8h</span><span class="hl-1">: </span><span class="hl-3">false</span><span class="hl-1"> }</span><br/><span class="hl-1">}</span>
|
| 44 |
</code><button type="button">Copy</button></pre>
|
| 45 |
|
| 46 |
<a id="reusing-the-schema-in-your-project" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Reusing the Schema in Your Project<a href="#reusing-the-schema-in-your-project" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Copy <code>addExchangeSchema</code> block from <code>src/index.mjs</code> into your own strategy file and reference it by name:</p>
|
| 47 |
+
<pre><code class="javascript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">Exchange</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">"backtest-kit"</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">candles</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Exchange</span><span class="hl-1">.</span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-2">"ETHUSDT"</span><span class="hl-1">, </span><span class="hl-2">"15m"</span><span class="hl-1">, </span><span class="hl-7">100</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"ccxt-exchange"</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
|
| 48 |
</code><button type="button">Copy</button></pre>
|
| 49 |
|
| 50 |
<a id="customizing-the-exchange" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Customizing the Exchange<a href="#customizing-the-exchange" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Replace <code>ccxt.binance</code> with any other CCXT-supported exchange:</p>
|
| 51 |
+
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-4">ccxt</span><span class="hl-1">.</span><span class="hl-0">bybit</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">enableRateLimit:</span><span class="hl-1"> </span><span class="hl-3">true</span><span class="hl-1">,</span><br/><span class="hl-1">});</span>
|
| 52 |
</code><button type="button">Copy</button></pre>
|
| 53 |
|
| 54 |
<a id="how-it-works" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How It Works<a href="#how-it-works" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="exchange-initialization" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Exchange Initialization<a href="#exchange-initialization" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>A single Binance spot instance is created lazily via <code>singleshot</code> and reused across all calls:</p>
|
| 55 |
+
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">getExchange</span><span class="hl-1"> = </span><span class="hl-0">singleshot</span><span class="hl-1">(</span><span class="hl-3">async</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">exchange</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-4">ccxt</span><span class="hl-1">.</span><span class="hl-0">binance</span><span class="hl-1">({ ... });</span><br/><span class="hl-1"> </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">exchange</span><span class="hl-1">.</span><span class="hl-0">loadMarkets</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">exchange</span><span class="hl-1">;</span><br/><span class="hl-1">});</span>
|
| 56 |
</code><button type="button">Copy</button></pre>
|
| 57 |
|
| 58 |
<a id="price--quantity-formatting" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Price / Quantity Formatting<a href="#price--quantity-formatting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Uses market <code>limits</code> (tick size / step size) with <code>roundTicks</code> fallback to CCXT precision methods:</p>
|
| 59 |
+
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">tickSize</span><span class="hl-1"> = </span><span class="hl-4">market</span><span class="hl-1">.</span><span class="hl-4">limits</span><span class="hl-1">?.</span><span class="hl-4">price</span><span class="hl-1">?.</span><span class="hl-4">min</span><span class="hl-1"> || </span><span class="hl-4">market</span><span class="hl-1">.</span><span class="hl-4">precision</span><span class="hl-1">?.</span><span class="hl-4">price</span><span class="hl-1">;</span><br/><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">tickSize</span><span class="hl-1"> !== </span><span class="hl-3">undefined</span><br/><span class="hl-1"> ? </span><span class="hl-0">roundTicks</span><span class="hl-1">(</span><span class="hl-4">price</span><span class="hl-1">, </span><span class="hl-4">tickSize</span><span class="hl-1">)</span><br/><span class="hl-1"> : </span><span class="hl-4">exchange</span><span class="hl-1">.</span><span class="hl-0">priceToPrecision</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">price</span><span class="hl-1">);</span>
|
| 60 |
</code><button type="button">Copy</button></pre>
|
| 61 |
|
| 62 |
<a id="order-book" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Order Book<a href="#order-book" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Returns normalized <code>{ asks, bids }</code> arrays with string price/quantity. Throws in backtest mode — implement your own snapshot replay if needed.</p>
|
| 63 |
<a id="aggregated-trades" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Aggregated Trades<a href="#aggregated-trades" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Uses Binance-specific <code>publicGetAggTrades</code> endpoint with <code>startTime</code>/<code>endTime</code> window.</p>
|
| 64 |
<a id="volume-anomaly-getexecutedtradesskew" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Volume Anomaly (<code>getExecutedTradesSkew</code>)<a href="#volume-anomaly-getexecutedtradesskew" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Fetches <code>N_TRAIN + N_DETECT</code> (1 400) aggregated trades and splits them into a calibration baseline and a detection window with no overlap:</p>
|
| 65 |
+
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">all</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Exchange</span><span class="hl-1">.</span><span class="hl-0">getAggregatedTrades</span><span class="hl-1">(</span><span class="hl-4">symbol</span><span class="hl-1">, { </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"ccxt-exchange"</span><span class="hl-1"> }, </span><span class="hl-7">1400</span><span class="hl-1">);</span><br/><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">anomaly</span><span class="hl-1">.</span><span class="hl-0">predict</span><span class="hl-1">(</span><span class="hl-4">all</span><span class="hl-1">.</span><span class="hl-0">slice</span><span class="hl-1">(</span><span class="hl-7">0</span><span class="hl-1">, </span><span class="hl-7">1200</span><span class="hl-1">), </span><span class="hl-4">all</span><span class="hl-1">.</span><span class="hl-0">slice</span><span class="hl-1">(</span><span class="hl-7">1200</span><span class="hl-1">), </span><span class="hl-7">0.75</span><span class="hl-1">);</span>
|
| 66 |
</code><button type="button">Copy</button></pre>
|
| 67 |
|
| 68 |
<p>Returns <code>{ anomaly, confidence, direction, imbalance }</code>.</p>
|
| 69 |
<a id="volatility-forecast-getvolatilityforecast" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Volatility Forecast (<code>getVolatilityForecast</code>)<a href="#volatility-forecast-getvolatilityforecast" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Fetches candles across 8 timeframes (1m, 5m, 15m, 30m, 1h, 4h, 6h, 8h) and runs <code>garch.predict()</code> on each. Returns per-timeframe <code>{ sigma, reliable }</code> pairs grouped by interval:</p>
|
| 70 |
+
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> { </span><span class="hl-4">sigma</span><span class="hl-1">: </span><span class="hl-8">sigma_1m</span><span class="hl-1">, </span><span class="hl-4">reliable</span><span class="hl-1">: </span><span class="hl-8">reliable_1m</span><span class="hl-1"> } = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">volatility</span><span class="hl-1">.</span><span class="hl-0">predict</span><span class="hl-1">(</span><span class="hl-4">candles_1m</span><span class="hl-1">, </span><span class="hl-2">"1m"</span><span class="hl-1">);</span><br/><span class="hl-6">// ...</span><br/><span class="hl-5">return</span><span class="hl-1"> { </span><span class="hl-4">volatility_1m</span><span class="hl-1">, </span><span class="hl-4">volatility_5m</span><span class="hl-1">, ..., </span><span class="hl-4">volatility_8h</span><span class="hl-1"> };</span>
|
| 71 |
</code><button type="button">Copy</button></pre>
|
| 72 |
|
| 73 |
<a id="analysis-libraries" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Analysis Libraries<a href="#analysis-libraries" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The aggregated trades and candles fetched via this exchange schema are used directly in the two companion analysis functions above.</p>
|
| 74 |
<a id="garch--volatility-forecasting" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code>garch</code> — Volatility Forecasting<a href="#garch--volatility-forecasting" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Forecasts the expected price range for the next candle(s) using realized GARCH-family models. Auto-selects the best model (GARCH, EGARCH, GJR-GARCH, HAR-RV, NoVaS) by QLIKE error comparison.</p>
|
| 75 |
+
<pre><code class="javascript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">predict</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">'garch'</span><span class="hl-1">;</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">candles</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Exchange</span><span class="hl-1">.</span><span class="hl-0">getCandles</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-2">"4h"</span><span class="hl-1">, </span><span class="hl-7">200</span><span class="hl-1">, { </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"ccxt-exchange"</span><span class="hl-1"> });</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">result</span><span class="hl-1"> = </span><span class="hl-0">predict</span><span class="hl-1">(</span><span class="hl-4">candles</span><span class="hl-1">, </span><span class="hl-2">'4h'</span><span class="hl-1">);</span><br/><span class="hl-6">// {</span><br/><span class="hl-6">// currentPrice: 97500,</span><br/><span class="hl-6">// sigma: 0.012, // 1.2% per-period volatility</span><br/><span class="hl-6">// upperPrice: 98677, // P·exp(+σ) — ceiling</span><br/><span class="hl-6">// lowerPrice: 96337, // P·exp(-σ) — floor</span><br/><span class="hl-6">// modelType: 'egarch',</span><br/><span class="hl-6">// reliable: true</span><br/><span class="hl-6">// }</span>
|
| 76 |
</code><button type="button">Copy</button></pre>
|
| 77 |
|
| 78 |
<p>Use <code>predictRange(candles, interval, steps)</code> for multi-candle swing trade corridors. Use <code>backtest(candles, interval)</code> for walk-forward validation of model accuracy.</p>
|
|
|
|
| 106 |
<p>See the <a href="https://www.npmjs.com/package/garch">garch npm page</a> for the full API reference.</p>
|
| 107 |
<hr>
|
| 108 |
<a id="volume-anomaly--trade-flow-anomaly-detection" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code>volume-anomaly</code> — Trade Flow Anomaly Detection<a href="#volume-anomaly--trade-flow-anomaly-detection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Detects abnormal surges in trade flow from a raw stream of aggregated trades. Three independent detectors run in parallel (Hawkes Process, CUSUM, Bayesian Online Changepoint Detection) and combine into a single <code>confidence</code> score.</p>
|
| 109 |
+
<pre><code class="javascript"><span class="hl-5">import</span><span class="hl-1"> { </span><span class="hl-4">predict</span><span class="hl-1"> } </span><span class="hl-5">from</span><span class="hl-1"> </span><span class="hl-2">'volume-anomaly'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// Fetch trades using getAggregatedTrades from the exchange schema</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">all</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Exchange</span><span class="hl-1">.</span><span class="hl-0">getAggregatedTrades</span><span class="hl-1">(</span><span class="hl-2">"BTCUSDT"</span><span class="hl-1">, </span><span class="hl-4">from</span><span class="hl-1">, </span><span class="hl-4">to</span><span class="hl-1">, { </span><span class="hl-4">exchangeName:</span><span class="hl-1"> </span><span class="hl-2">"ccxt-exchange"</span><span class="hl-1"> });</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">historical</span><span class="hl-1"> = </span><span class="hl-4">all</span><span class="hl-1">.</span><span class="hl-0">slice</span><span class="hl-1">(</span><span class="hl-7">0</span><span class="hl-1">, </span><span class="hl-7">1200</span><span class="hl-1">); </span><span class="hl-6">// calibration baseline</span><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">recent</span><span class="hl-1"> = </span><span class="hl-4">all</span><span class="hl-1">.</span><span class="hl-0">slice</span><span class="hl-1">(</span><span class="hl-7">1200</span><span class="hl-1">); </span><span class="hl-6">// window to evaluate — no overlap</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">result</span><span class="hl-1"> = </span><span class="hl-0">predict</span><span class="hl-1">(</span><span class="hl-4">historical</span><span class="hl-1">, </span><span class="hl-4">recent</span><span class="hl-1">, </span><span class="hl-7">0.75</span><span class="hl-1">);</span><br/><span class="hl-6">// {</span><br/><span class="hl-6">// anomaly: true,</span><br/><span class="hl-6">// confidence: 0.83,</span><br/><span class="hl-6">// direction: 'long', // 'long' | 'short' | 'neutral'</span><br/><span class="hl-6">// imbalance: 0.61,</span><br/><span class="hl-6">// }</span>
|
| 110 |
</code><button type="button">Copy</button></pre>
|
| 111 |
|
| 112 |
<blockquote>
|
documents/demo_live_readme.html
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
documents/demo_optimization_readme.html
CHANGED
|
@@ -48,10 +48,10 @@
|
|
| 48 |
<li><strong>Utilities</strong>: functools-kit 1.0.93</li>
|
| 49 |
<li><strong>Data Source</strong>: node-ccxt-dumper API</li>
|
| 50 |
</ul>
|
| 51 |
-
<a id="project-structure" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Project Structure<a href="#project-structure" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code><span class="hl-
|
| 52 |
</code><button>Copy</button></pre>
|
| 53 |
|
| 54 |
-
<a id="installation-and-setup" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation and Setup<a href="#installation-and-setup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-6"># Navigate to project directory</span><br/><span class="hl-0">cd</span><span class="hl-1"> </span><span class="hl-2">demo/optimization</span><br/><br/><span class="hl-6"># Install dependencies</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><br/><br/><span class="hl-6"># Set environment variables</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-
|
| 55 |
</code><button type="button">Copy</button></pre>
|
| 56 |
|
| 57 |
<a id="configuration" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="environment-variables" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Environment Variables<a href="#environment-variables" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Create a <code>.env</code> file or set environment variables:</p>
|
|
@@ -93,11 +93,11 @@ CCXT_DUMPER_URL=node-ccxt-dumper-instance
|
|
| 93 |
<li>Output best strategy statistics</li>
|
| 94 |
</ol>
|
| 95 |
<a id="customizing-symbols" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Customizing Symbols<a href="#customizing-symbols" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Modify <code>src/index.mjs</code> to analyze different cryptocurrencies:</p>
|
| 96 |
-
<pre><code class="javascript"><span class="hl-
|
| 97 |
</code><button type="button">Copy</button></pre>
|
| 98 |
|
| 99 |
<a id="adjusting-time-ranges" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adjusting Time Ranges<a href="#adjusting-time-ranges" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Edit training/testing periods in <code>src/index.mjs</code>:</p>
|
| 100 |
-
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">TRAIN_RANGE</span><span class="hl-1"> = [</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-
|
| 101 |
</code><button type="button">Copy</button></pre>
|
| 102 |
|
| 103 |
<a id="how-it-works" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How It Works<a href="#how-it-works" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="phase-1-data-collection" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Phase 1: Data Collection<a href="#phase-1-data-collection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>For each training period (7 days):</p>
|
|
@@ -133,7 +133,7 @@ CCXT_DUMPER_URL=node-ccxt-dumper-instance
|
|
| 133 |
<li>Output best-performing strategy</li>
|
| 134 |
</ol>
|
| 135 |
<a id="llm-prompt-engineering" class="tsd-anchor"></a><h2 class="tsd-anchor-link">LLM Prompt Engineering<a href="#llm-prompt-engineering" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The system uses strategic prompting for better strategy generation:</p>
|
| 136 |
-
<pre><code class="javascript"><span class="hl-6">// System prompt</span><br/><span class="hl-2">"В ответ напиши торговую стратегию где нет ничего лишнего</span><span class="hl-12">,</span><br/><span class="hl-
|
| 137 |
</code><button type="button">Copy</button></pre>
|
| 138 |
|
| 139 |
<p>This encourages:</p>
|
|
@@ -162,13 +162,13 @@ CCXT_DUMPER_URL=node-ccxt-dumper-instance
|
|
| 162 |
<li><strong>Time Savings</strong>: Minutes vs. days of manual strategy development</li>
|
| 163 |
<li><strong>Reproducibility</strong>: Deterministic code generation from data</li>
|
| 164 |
</ul>
|
| 165 |
-
<a id="advanced-customization" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Advanced Customization<a href="#advanced-customization" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="adding-new-data-sources" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adding New Data Sources<a href="#adding-new-data-sources" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-8">SOURCE_LIST</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-
|
| 166 |
</code><button type="button">Copy</button></pre>
|
| 167 |
|
| 168 |
-
<a id="changing-llm-model" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Changing LLM Model<a href="#changing-llm-model" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">response</span><span class="hl-1"> = </span><span class="hl-
|
| 169 |
</code><button type="button">Copy</button></pre>
|
| 170 |
|
| 171 |
-
<a id="custom-optimizer-callbacks" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Custom Optimizer Callbacks<a href="#custom-optimizer-callbacks" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-0">addOptimizer</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-
|
| 172 |
</code><button type="button">Copy</button></pre>
|
| 173 |
|
| 174 |
<a id="related-projects" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Related Projects<a href="#related-projects" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|
|
|
|
| 48 |
<li><strong>Utilities</strong>: functools-kit 1.0.93</li>
|
| 49 |
<li><strong>Data Source</strong>: node-ccxt-dumper API</li>
|
| 50 |
</ul>
|
| 51 |
+
<a id="project-structure" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Project Structure<a href="#project-structure" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code><span class="hl-4">demo</span><span class="hl-1">/</span><span class="hl-4">optimization</span><span class="hl-1">/</span><br/><span class="hl-1">├── </span><span class="hl-4">src</span><span class="hl-1">/</span><br/><span class="hl-1">│ └── </span><span class="hl-4">index</span><span class="hl-1">.</span><span class="hl-4">mjs</span><span class="hl-1"> # </span><span class="hl-4">Main</span><span class="hl-1"> </span><span class="hl-4">optimizer</span><span class="hl-1"> </span><span class="hl-4">configuration</span><br/><span class="hl-1">├── </span><span class="hl-4">generated</span><span class="hl-1">/ # </span><span class="hl-8">AI</span><span class="hl-1">-</span><span class="hl-4">generated</span><span class="hl-1"> </span><span class="hl-4">strategy</span><span class="hl-1"> </span><span class="hl-0">code</span><span class="hl-1"> (</span><span class="hl-4">output</span><span class="hl-1">)</span><br/><span class="hl-1">├── </span><span class="hl-4">package</span><span class="hl-1">.</span><span class="hl-4">json</span><span class="hl-1"> # </span><span class="hl-4">Dependencies</span><span class="hl-1"> </span><span class="hl-4">and</span><span class="hl-1"> </span><span class="hl-4">scripts</span><br/><span class="hl-1">└── </span><span class="hl-8">README</span><span class="hl-1">.</span><span class="hl-4">md</span><span class="hl-1"> # </span><span class="hl-4">This</span><span class="hl-1"> </span><span class="hl-4">file</span>
|
| 52 |
</code><button>Copy</button></pre>
|
| 53 |
|
| 54 |
+
<a id="installation-and-setup" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Installation and Setup<a href="#installation-and-setup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><pre><code class="bash"><span class="hl-6"># Navigate to project directory</span><br/><span class="hl-0">cd</span><span class="hl-1"> </span><span class="hl-2">demo/optimization</span><br/><br/><span class="hl-6"># Install dependencies</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><br/><br/><span class="hl-6"># Set environment variables</span><br/><span class="hl-3">export</span><span class="hl-1"> </span><span class="hl-4">OLLAMA_API_KEY</span><span class="hl-1">=</span><span class="hl-4">your_ollama_api_key</span><br/><br/><span class="hl-6"># Run optimizer</span><br/><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">start</span>
|
| 55 |
</code><button type="button">Copy</button></pre>
|
| 56 |
|
| 57 |
<a id="configuration" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Configuration<a href="#configuration" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="environment-variables" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Environment Variables<a href="#environment-variables" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Create a <code>.env</code> file or set environment variables:</p>
|
|
|
|
| 93 |
<li>Output best strategy statistics</li>
|
| 94 |
</ol>
|
| 95 |
<a id="customizing-symbols" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Customizing Symbols<a href="#customizing-symbols" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Modify <code>src/index.mjs</code> to analyze different cryptocurrencies:</p>
|
| 96 |
+
<pre><code class="javascript"><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">Optimizer</span><span class="hl-1">.</span><span class="hl-0">dump</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"ETHUSDT"</span><span class="hl-1">, </span><span class="hl-6">// Change symbol</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">optimizerName:</span><span class="hl-1"> </span><span class="hl-2">"btc-optimizer"</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-2">"./generated"</span><br/><span class="hl-1">);</span>
|
| 97 |
</code><button type="button">Copy</button></pre>
|
| 98 |
|
| 99 |
<a id="adjusting-time-ranges" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adjusting Time Ranges<a href="#adjusting-time-ranges" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>Edit training/testing periods in <code>src/index.mjs</code>:</p>
|
| 100 |
+
<pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">TRAIN_RANGE</span><span class="hl-1"> = [</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-2">"Custom period 1"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">startDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2025-01-01T00:00:00Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-4">endDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2025-01-01T23:59:59Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-6">// Add more training periods...</span><br/><span class="hl-1">];</span><br/><br/><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">TEST_RANGE</span><span class="hl-1"> = {</span><br/><span class="hl-1"> </span><span class="hl-4">note:</span><span class="hl-1"> </span><span class="hl-2">"Validation period"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">startDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2025-01-08T00:00:00Z"</span><span class="hl-1">),</span><br/><span class="hl-1"> </span><span class="hl-4">endDate:</span><span class="hl-1"> </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">Date</span><span class="hl-1">(</span><span class="hl-2">"2025-01-08T23:59:59Z"</span><span class="hl-1">),</span><br/><span class="hl-1">};</span>
|
| 101 |
</code><button type="button">Copy</button></pre>
|
| 102 |
|
| 103 |
<a id="how-it-works" class="tsd-anchor"></a><h2 class="tsd-anchor-link">How It Works<a href="#how-it-works" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="phase-1-data-collection" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Phase 1: Data Collection<a href="#phase-1-data-collection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>For each training period (7 days):</p>
|
|
|
|
| 133 |
<li>Output best-performing strategy</li>
|
| 134 |
</ol>
|
| 135 |
<a id="llm-prompt-engineering" class="tsd-anchor"></a><h2 class="tsd-anchor-link">LLM Prompt Engineering<a href="#llm-prompt-engineering" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The system uses strategic prompting for better strategy generation:</p>
|
| 136 |
+
<pre><code class="javascript"><span class="hl-6">// System prompt</span><br/><span class="hl-2">"В ответ напиши торговую стратегию где нет ничего лишнего</span><span class="hl-12">,</span><br/><span class="hl-4">только</span><span class="hl-1"> </span><span class="hl-4">отчёт</span><span class="hl-1"> </span><span class="hl-4">готовый</span><span class="hl-1"> </span><span class="hl-4">для</span><span class="hl-1"> </span><span class="hl-4">копипасты</span><span class="hl-1"> </span><span class="hl-4">целиком</span><br/><br/><span class="hl-1">**</span><span class="hl-8">ВАЖНО</span><span class="hl-1">**: </span><span class="hl-4">Не</span><span class="hl-1"> </span><span class="hl-4">здоровайся</span><span class="hl-1">, </span><span class="hl-4">не</span><span class="hl-1"> </span><span class="hl-4">говори</span><span class="hl-1"> </span><span class="hl-4">что</span><span class="hl-1"> </span><span class="hl-4">делаешь</span><span class="hl-1"> - </span><span class="hl-4">только</span><span class="hl-1"> </span><span class="hl-4">отчёт</span><span class="hl-1">!</span><span class="hl-2">"</span><br/><br/><span class="hl-2">// User promp</span><span class="hl-12">t</span><br/><span class="hl-2">`На каких условиях мне купить </span><span class="hl-3">${</span><span class="hl-4">symbol</span><span class="hl-3">}</span><span class="hl-2">?</span><br/><span class="hl-2">Дай анализ рынка на основе поддержки/сопротивления, точек входа в LONG/SHORT позиции.</span><br/><span class="hl-2">Какой RR ставить для позиций?</span><br/><span class="hl-2">Предпочтительны LONG или SHORT позиции?</span><br/><br/><span class="hl-2">Сделай не сухой технический, а фундаментальный анализ,</span><br/><span class="hl-2">содержащий стратигическую рекомендацию, например, покупать на низу боковика`</span>
|
| 137 |
</code><button type="button">Copy</button></pre>
|
| 138 |
|
| 139 |
<p>This encourages:</p>
|
|
|
|
| 162 |
<li><strong>Time Savings</strong>: Minutes vs. days of manual strategy development</li>
|
| 163 |
<li><strong>Reproducibility</strong>: Deterministic code generation from data</li>
|
| 164 |
</ul>
|
| 165 |
+
<a id="advanced-customization" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Advanced Customization<a href="#advanced-customization" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><a id="adding-new-data-sources" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Adding New Data Sources<a href="#adding-new-data-sources" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-8">SOURCE_LIST</span><span class="hl-1">.</span><span class="hl-0">push</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-2">"custom-indicators"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-0">fetch</span><span class="hl-4">:</span><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> ({ </span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">startDate</span><span class="hl-1">, </span><span class="hl-4">endDate</span><span class="hl-1">, </span><span class="hl-4">limit</span><span class="hl-1">, </span><span class="hl-4">offset</span><span class="hl-1"> }) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">// Fetch custom data</span><br/><span class="hl-1"> </span><span class="hl-5">return</span><span class="hl-1"> </span><span class="hl-4">data</span><span class="hl-1">.</span><span class="hl-4">rows</span><span class="hl-1">;</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-0">user</span><span class="hl-4">:</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">data</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-4">str</span><span class="hl-1">.</span><span class="hl-0">newline</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">"=== CUSTOM INDICATORS ==="</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-8">JSON</span><span class="hl-1">.</span><span class="hl-0">stringify</span><span class="hl-1">(</span><span class="hl-4">data</span><span class="hl-1">)</span><br/><span class="hl-1"> ),</span><br/><span class="hl-1"> </span><span class="hl-0">assistant</span><span class="hl-4">:</span><span class="hl-1"> () </span><span class="hl-3">=></span><span class="hl-1"> </span><span class="hl-2">"Custom data received"</span><br/><span class="hl-1">});</span>
|
| 166 |
</code><button type="button">Copy</button></pre>
|
| 167 |
|
| 168 |
+
<a id="changing-llm-model" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Changing LLM Model<a href="#changing-llm-model" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-3">const</span><span class="hl-1"> </span><span class="hl-8">response</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">ollama</span><span class="hl-1">.</span><span class="hl-0">chat</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> </span><span class="hl-2">"llama3:70b"</span><span class="hl-1">, </span><span class="hl-6">// Use different model</span><br/><span class="hl-1"> </span><span class="hl-4">messages:</span><span class="hl-1"> [...]</span><br/><span class="hl-1">});</span>
|
| 169 |
</code><button type="button">Copy</button></pre>
|
| 170 |
|
| 171 |
+
<a id="custom-optimizer-callbacks" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Custom Optimizer Callbacks<a href="#custom-optimizer-callbacks" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><pre><code class="javascript"><span class="hl-0">addOptimizer</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">optimizerName:</span><span class="hl-1"> </span><span class="hl-2">"btc-optimizer"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-6">// ... existing config</span><br/><span class="hl-1"> </span><span class="hl-4">callbacks:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-0">onSourceData</span><span class="hl-4">:</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">sourceName</span><span class="hl-1">, </span><span class="hl-4">data</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`✓ Fetched </span><span class="hl-3">${</span><span class="hl-4">data</span><span class="hl-9">.</span><span class="hl-4">length</span><span class="hl-3">}</span><span class="hl-2"> rows from </span><span class="hl-3">${</span><span class="hl-4">sourceName</span><span class="hl-3">}</span><span class="hl-2">`</span><span class="hl-1">);</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-0">onData</span><span class="hl-4">:</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">strategies</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`✓ Generated </span><span class="hl-3">${</span><span class="hl-4">strategies</span><span class="hl-9">.</span><span class="hl-4">length</span><span class="hl-3">}</span><span class="hl-2"> strategies`</span><span class="hl-1">);</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-0">onCode</span><span class="hl-4">:</span><span class="hl-1"> (</span><span class="hl-4">symbol</span><span class="hl-1">, </span><span class="hl-4">code</span><span class="hl-1">) </span><span class="hl-3">=></span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`✓ Code generated: </span><span class="hl-3">${</span><span class="hl-4">code</span><span class="hl-9">.</span><span class="hl-4">length</span><span class="hl-3">}</span><span class="hl-2"> bytes`</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span>
|
| 172 |
</code><button type="button">Copy</button></pre>
|
| 173 |
|
| 174 |
<a id="related-projects" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Related Projects<a href="#related-projects" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|