Spaces:
Running
Running
| <html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ActionBase | 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.ActionBase.html">ActionBase</a></li></ul><h1>Class ActionBase</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Base class for custom action handlers.</p> | |
| <p>Provides default implementations for all IPublicAction methods that log events. | |
| Extend this class to implement custom action handlers for:</p> | |
| <ul> | |
| <li>State management (Redux, Zustand, MobX)</li> | |
| <li>Real-time notifications (Telegram, Discord, Email)</li> | |
| <li>Event logging and monitoring</li> | |
| <li>Analytics and metrics collection</li> | |
| <li>Custom business logic triggers</li> | |
| </ul> | |
| <p>Key features:</p> | |
| <ul> | |
| <li>All methods have default implementations (no need to implement unused methods)</li> | |
| <li>Automatic logging of all events via LOGGER_SERVICE</li> | |
| <li>Access to strategy context (strategyName, frameName, actionName)</li> | |
| <li>Implements full IPublicAction interface</li> | |
| </ul> | |
| <p>Lifecycle:</p> | |
| <ol> | |
| <li>Constructor called with (strategyName, frameName, actionName)</li> | |
| <li>init() called once for async initialization</li> | |
| <li>Event methods called as strategy executes (signal, breakeven, partialProfit, etc.)</li> | |
| <li>dispose() called once for cleanup</li> | |
| </ol> | |
| <p>Event flow:</p> | |
| <ul> | |
| <li>signal() - Called on every tick/candle (all modes)</li> | |
| <li>signalLive() - Called only in live mode</li> | |
| <li>signalBacktest() - Called only in backtest mode</li> | |
| <li>breakevenAvailable() - Called when SL moved to entry</li> | |
| <li>partialProfitAvailable() - Called on profit milestones (10%, 20%, etc.)</li> | |
| <li>partialLossAvailable() - Called on loss milestones (-10%, -20%, etc.)</li> | |
| <li>pingScheduled() - Called every minute during scheduled signal monitoring</li> | |
| <li>pingActive() - Called every minute during active pending signal monitoring</li> | |
| <li>riskRejection() - Called when signal rejected by risk management</li> | |
| </ul> | |
| </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-4">import</span><span class="hl-1"> { </span><span class="hl-5">ActionBase</span><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-6">// Extend ActionBase and override only needed methods</span><br/><span class="hl-3">class</span><span class="hl-1"> </span><span class="hl-11">TelegramNotifier</span><span class="hl-1"> </span><span class="hl-3">extends</span><span class="hl-1"> </span><span class="hl-11">ActionBase</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-5">bot</span><span class="hl-1">: </span><span class="hl-11">TelegramBot</span><span class="hl-1"> | </span><span class="hl-11">null</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-3">async</span><span class="hl-1"> </span><span class="hl-0">init</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">.</span><span class="hl-0">init</span><span class="hl-1">(); </span><span class="hl-6">// Call parent for logging</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">bot</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">TelegramBot</span><span class="hl-1">(</span><span class="hl-5">process</span><span class="hl-1">.</span><span class="hl-5">env</span><span class="hl-1">.</span><span class="hl-8">TELEGRAM_TOKEN</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-3">this</span><span class="hl-1">.</span><span class="hl-5">bot</span><span class="hl-1">.</span><span class="hl-0">connect</span><span class="hl-1">();</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-0">signal</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-11">IStrategyTickResult</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">.</span><span class="hl-0">signal</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">); </span><span class="hl-6">// Call parent for logging</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-5">event</span><span class="hl-1">.</span><span class="hl-5">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">await</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">bot</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`[</span><span class="hl-3">${</span><span class="hl-3">this</span><span class="hl-9">.</span><span class="hl-5">strategyName</span><span class="hl-3">}</span><span class="hl-2">/</span><span class="hl-3">${</span><span class="hl-3">this</span><span class="hl-9">.</span><span class="hl-5">frameName</span><span class="hl-3">}</span><span class="hl-2">] Signal opened: </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">signal</span><span class="hl-9">.</span><span class="hl-5">side</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><br/><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-0">breakeven</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-11">BreakevenContract</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">.</span><span class="hl-0">breakeven</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">); </span><span class="hl-6">// Call parent for logging</span><br/><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">bot</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`[</span><span class="hl-3">${</span><span class="hl-3">this</span><span class="hl-9">.</span><span class="hl-5">strategyName</span><span class="hl-3">}</span><span class="hl-2">] Breakeven reached at </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">currentPrice</span><span class="hl-3">}</span><span class="hl-2">`</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-3">async</span><span class="hl-1"> </span><span class="hl-0">dispose</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">.</span><span class="hl-0">dispose</span><span class="hl-1">(); </span><span class="hl-6">// Call parent for logging</span><br/><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">bot</span><span class="hl-1">?.</span><span class="hl-0">disconnect</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">bot</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><br/><br/><span class="hl-6">// Register the action</span><br/><span class="hl-0">addActionSchema</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">actionName:</span><span class="hl-1"> </span><span class="hl-2">"telegram-notifier"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">handler:</span><span class="hl-1"> </span><span class="hl-5">TelegramNotifier</span><br/><span class="hl-1">});</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div><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">// Redux state management example</span><br/><span class="hl-3">class</span><span class="hl-1"> </span><span class="hl-11">ReduxAction</span><span class="hl-1"> </span><span class="hl-3">extends</span><span class="hl-1"> </span><span class="hl-11">ActionBase</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">constructor</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-11">StrategyName</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-11">FrameName</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">actionName</span><span class="hl-1">: </span><span class="hl-11">ActionName</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-3">private</span><span class="hl-1"> </span><span class="hl-5">store</span><span class="hl-1">: </span><span class="hl-11">Store</span><br/><span class="hl-1"> ) {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">(</span><span class="hl-5">strategyName</span><span class="hl-1">, </span><span class="hl-5">frameName</span><span class="hl-1">, </span><span class="hl-5">actionName</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-0">signal</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-11">IStrategyTickResult</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">store</span><span class="hl-1">.</span><span class="hl-0">dispatch</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">type:</span><span class="hl-1"> </span><span class="hl-2">'STRATEGY_SIGNAL'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">payload:</span><span class="hl-1"> { </span><span class="hl-5">event</span><span class="hl-1">, </span><span class="hl-5">strategyName:</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">strategyName</span><span class="hl-1">, </span><span class="hl-5">frameName:</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">frameName</span><span class="hl-1"> }</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> }</span><br/><br/><span class="hl-1"> </span><span class="hl-0">partialProfit</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-11">PartialProfitContract</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">store</span><span class="hl-1">.</span><span class="hl-0">dispatch</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-5">type:</span><span class="hl-1"> </span><span class="hl-2">'PARTIAL_PROFIT'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-5">payload:</span><span class="hl-1"> { </span><span class="hl-5">event</span><span class="hl-1">, </span><span class="hl-5">strategyName:</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">strategyName</span><span class="hl-1"> }</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div></section><section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><a href="../types/types.IPublicAction.html" class="tsd-signature-type tsd-kind-type-alias">IPublicAction</a></li></ul></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L24966">types.d.ts:24966</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.ActionBase.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> | |
| </div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="types.ActionBase.html#actionname" 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>action<wbr/>Name</span></a> | |
| <a href="types.ActionBase.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> | |
| <a href="types.ActionBase.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> | |
| <a href="types.ActionBase.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> | |
| </div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="types.ActionBase.html#breakevenavailable" 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>breakeven<wbr/>Available</span></a> | |
| <a href="types.ActionBase.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> | |
| <a href="types.ActionBase.html#init" 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>init</span></a> | |
| <a href="types.ActionBase.html#partiallossavailable" 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>partial<wbr/>Loss<wbr/>Available</span></a> | |
| <a href="types.ActionBase.html#partialprofitavailable" 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>partial<wbr/>Profit<wbr/>Available</span></a> | |
| <a href="types.ActionBase.html#pingactive" 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>ping<wbr/>Active</span></a> | |
| <a href="types.ActionBase.html#pingidle" 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>ping<wbr/>Idle</span></a> | |
| <a href="types.ActionBase.html#pingscheduled" 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>ping<wbr/>Scheduled</span></a> | |
| <a href="types.ActionBase.html#riskrejection" 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>risk<wbr/>Rejection</span></a> | |
| <a href="types.ActionBase.html#signal" 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>signal</span></a> | |
| <a href="types.ActionBase.html#signalbacktest" 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>signal<wbr/>Backtest</span></a> | |
| <a href="types.ActionBase.html#signallive" 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>signal<wbr/>Live</span></a> | |
| </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="constructoractionbase" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">ActionBase</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">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">actionName</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.ActionBase.html" class="tsd-signature-type tsd-kind-class">ActionBase</a><a href="#constructoractionbase" aria-label="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 ActionBase instance.</p> | |
| </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 this action is attached to</p> | |
| </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>Timeframe identifier this action is attached to</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">actionName</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Action identifier</p> | |
| </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>If running in backtest</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="types.ActionBase.html" class="tsd-signature-type tsd-kind-class">ActionBase</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/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L24979">types.d.ts:24979</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="actionname" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>action<wbr/>Name</span><a href="#actionname" aria-label="Permalink" 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">actionName</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/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L24969">types.d.ts:24969</a></li></ul></aside></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/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L24970">types.d.ts:24970</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/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L24968">types.d.ts:24968</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/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L24967">types.d.ts:24967</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="breakevenavailable" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>breakeven<wbr/>Available</span><a href="#breakevenavailable" aria-label="Permalink" 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="breakevenavailable-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">breakevenAvailable</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.BreakevenContract.html" class="tsd-signature-type tsd-kind-interface">BreakevenContract</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">source</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> <span class="tsd-signature-type">void</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="#breakevenavailable-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>Handles breakeven events when stop-loss is moved to entry price.</p> | |
| <p>Called once per signal when price moves far enough to cover fees and slippage. | |
| Breakeven threshold: (CC_PERCENT_SLIPPAGE + CC_PERCENT_FEE) * 2 + CC_BREAKEVEN_THRESHOLD</p> | |
| <p>Triggered by: ActionCoreService.breakevenAvailable() via BreakevenConnectionService | |
| Source: breakevenSubject.next() in CREATE_COMMIT_BREAKEVEN_FN callback | |
| Frequency: Once per signal when threshold reached</p> | |
| <p>Default implementation: Logs breakeven event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../interfaces/types.BreakevenContract.html" class="tsd-signature-type tsd-kind-interface">BreakevenContract</a></span><div class="tsd-comment tsd-typography"><p>Breakeven milestone data with signal info, current price, timestamp</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><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-5">async</span><span class="hl-1"> </span><span class="hl-0">breakevenAvailable</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">BreakevenContract</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-3">this</span><span class="hl-1">.</span><span class="hl-5">telegram</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`[</span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">strategyName</span><span class="hl-3">}</span><span class="hl-2">] Breakeven reached! `</span><span class="hl-1"> +</span><br/><span class="hl-1"> </span><span class="hl-2">`Signal: </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">data</span><span class="hl-9">.</span><span class="hl-5">side</span><span class="hl-3">}</span><span class="hl-2"> @ </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">currentPrice</span><span class="hl-3">}</span><span class="hl-2">`</span><br/><span class="hl-1"> );</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.breakevenAvailable</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25101">types.d.ts:25101</a></li></ul></aside></div></li></ul></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-kind-parameter">source</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> <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="#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>Cleans up resources and subscriptions when action handler is disposed.</p> | |
| <p>Called once when strategy execution ends. | |
| Guaranteed to run exactly once via singleshot pattern.</p> | |
| <p>Override to:</p> | |
| <ul> | |
| <li>Close database connections</li> | |
| <li>Disconnect from external services</li> | |
| <li>Flush buffers</li> | |
| <li>Save state to disk</li> | |
| <li>Unsubscribe from observables</li> | |
| </ul> | |
| <p>Default implementation: Logs dispose event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><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-5">async</span><span class="hl-1"> </span><span class="hl-0">dispose</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">.</span><span class="hl-0">dispose</span><span class="hl-1">(); </span><span class="hl-6">// Keep parent logging</span><br/><span class="hl-1"> </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">db</span><span class="hl-1">?.</span><span class="hl-0">disconnect</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-3">this</span><span class="hl-1">.</span><span class="hl-5">telegram</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">await</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">cache</span><span class="hl-1">?.</span><span class="hl-0">quit</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">'Action disposed successfully'</span><span class="hl-1">);</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.dispose</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25270">types.d.ts:25270</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="init" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>init</span><a href="#init" aria-label="Permalink" 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="init-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">init</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</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> <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="#init-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 action handler.</p> | |
| <p>Called once after construction. Override to perform async initialization:</p> | |
| <ul> | |
| <li>Establish database connections</li> | |
| <li>Initialize API clients</li> | |
| <li>Load configuration files</li> | |
| <li>Open file handles or network sockets</li> | |
| </ul> | |
| <p>Default implementation: Logs initialization event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-4" class="tsd-anchor"></a>Example<a href="#example-4" aria-label="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">async</span><span class="hl-1"> </span><span class="hl-0">init</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-3">super</span><span class="hl-1">.</span><span class="hl-0">init</span><span class="hl-1">(); </span><span class="hl-6">// Keep parent logging</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">db</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-0">connectToDatabase</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">telegram</span><span class="hl-1"> = </span><span class="hl-3">new</span><span class="hl-1"> </span><span class="hl-0">TelegramBot</span><span class="hl-1">(</span><span class="hl-5">process</span><span class="hl-1">.</span><span class="hl-5">env</span><span class="hl-1">.</span><span class="hl-8">TOKEN</span><span class="hl-1">);</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.init</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25000">types.d.ts:25000</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="partiallossavailable" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>partial<wbr/>Loss<wbr/>Available</span><a href="#partiallossavailable" aria-label="Permalink" 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="partiallossavailable-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">partialLossAvailable</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.PartialLossContract.html" class="tsd-signature-type tsd-kind-interface">PartialLossContract</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">source</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> <span class="tsd-signature-type">void</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="#partiallossavailable-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>Handles partial loss level events (-10%, -20%, -30%, etc).</p> | |
| <p>Called once per loss level per signal (deduplicated). | |
| Use to track loss milestones and implement risk management actions.</p> | |
| <p>Triggered by: ActionCoreService.partialLossAvailable() via PartialConnectionService | |
| Source: partialLossSubject.next() in CREATE_COMMIT_LOSS_FN callback | |
| Frequency: Once per loss level per signal</p> | |
| <p>Default implementation: Logs partial loss event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../interfaces/types.PartialLossContract.html" class="tsd-signature-type tsd-kind-interface">PartialLossContract</a></span><div class="tsd-comment tsd-typography"><p>Loss milestone data with signal info, level (-10, -20, -30...), price, timestamp</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-5" class="tsd-anchor"></a>Example<a href="#example-5" aria-label="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">async</span><span class="hl-1"> </span><span class="hl-0">partialLossAvailable</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">PartialLossContract</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-3">this</span><span class="hl-1">.</span><span class="hl-5">telegram</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`[</span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">strategyName</span><span class="hl-3">}</span><span class="hl-2">] Loss </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">level</span><span class="hl-3">}</span><span class="hl-2">% reached! `</span><span class="hl-1"> +</span><br/><span class="hl-1"> </span><span class="hl-2">`Current price: </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">currentPrice</span><span class="hl-3">}</span><span class="hl-2">`</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-6">// Optionally adjust risk management</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.partialLossAvailable</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25153">types.d.ts:25153</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="partialprofitavailable" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>partial<wbr/>Profit<wbr/>Available</span><a href="#partialprofitavailable" aria-label="Permalink" 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="partialprofitavailable-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">partialProfitAvailable</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.PartialProfitContract.html" class="tsd-signature-type tsd-kind-interface">PartialProfitContract</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">source</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> <span class="tsd-signature-type">void</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="#partialprofitavailable-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>Handles partial profit level events (10%, 20%, 30%, etc).</p> | |
| <p>Called once per profit level per signal (deduplicated). | |
| Use to track profit milestones and adjust position management.</p> | |
| <p>Triggered by: ActionCoreService.partialProfitAvailable() via PartialConnectionService | |
| Source: partialProfitSubject.next() in CREATE_COMMIT_PROFIT_FN callback | |
| Frequency: Once per profit level per signal</p> | |
| <p>Default implementation: Logs partial profit event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../interfaces/types.PartialProfitContract.html" class="tsd-signature-type tsd-kind-interface">PartialProfitContract</a></span><div class="tsd-comment tsd-typography"><p>Profit milestone data with signal info, level (10, 20, 30...), price, timestamp</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-6" class="tsd-anchor"></a>Example<a href="#example-6" aria-label="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">async</span><span class="hl-1"> </span><span class="hl-0">partialProfitAvailable</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">PartialProfitContract</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-3">this</span><span class="hl-1">.</span><span class="hl-5">telegram</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`[</span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">strategyName</span><span class="hl-3">}</span><span class="hl-2">] Profit </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">level</span><span class="hl-3">}</span><span class="hl-2">% reached! `</span><span class="hl-1"> +</span><br/><span class="hl-1"> </span><span class="hl-2">`Current price: </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">currentPrice</span><span class="hl-3">}</span><span class="hl-2">`</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-6">// Optionally tighten stop-loss or take partial profit</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.partialProfitAvailable</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25127">types.d.ts:25127</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="pingactive" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>ping<wbr/>Active</span><a href="#pingactive" aria-label="Permalink" 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="pingactive-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">pingActive</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.ActivePingContract.html" class="tsd-signature-type tsd-kind-interface">ActivePingContract</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">source</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> <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="#pingactive-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>Handles active ping events during active pending signal monitoring.</p> | |
| <p>Called every minute while a pending signal is active (position open). | |
| Use to monitor active positions and track lifecycle.</p> | |
| <p>Triggered by: ActionCoreService.pingActive() via StrategyConnectionService | |
| Source: activePingSubject.next() in CREATE_COMMIT_ACTIVE_PING_FN callback | |
| Frequency: Every minute while pending signal is active</p> | |
| <p>Default implementation: Logs active ping event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../interfaces/types.ActivePingContract.html" class="tsd-signature-type tsd-kind-interface">ActivePingContract</a></span><div class="tsd-comment tsd-typography"><p>Active pending signal monitoring data with symbol, strategy info, signal data, timestamp</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-7" class="tsd-anchor"></a>Example<a href="#example-7" aria-label="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-0">pingActive</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">ActivePingContract</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">holdTime</span><span class="hl-1"> = </span><span class="hl-0">getTimestamp</span><span class="hl-1">() - </span><span class="hl-5">event</span><span class="hl-1">.</span><span class="hl-5">data</span><span class="hl-1">.</span><span class="hl-5">pendingAt</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">holdMinutes</span><span class="hl-1"> = </span><span class="hl-5">Math</span><span class="hl-1">.</span><span class="hl-0">floor</span><span class="hl-1">(</span><span class="hl-5">holdTime</span><span class="hl-1"> / </span><span class="hl-7">60000</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Active signal holding </span><span class="hl-3">${</span><span class="hl-5">holdMinutes</span><span class="hl-3">}</span><span class="hl-2"> minutes`</span><span class="hl-1">);</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.pingActive</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25201">types.d.ts:25201</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="pingidle" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>ping<wbr/>Idle</span><a href="#pingidle" aria-label="Permalink" 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="pingidle-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">pingIdle</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.IdlePingContract.html" class="tsd-signature-type tsd-kind-interface">IdlePingContract</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">source</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> <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="#pingidle-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>Handles idle ping events when no signal is active.</p> | |
| <p>Called every tick while no signal is pending or scheduled. | |
| Use to monitor idle strategy state and implement entry condition logic.</p> | |
| <p>Triggered by: ActionCoreService.pingIdle() via StrategyConnectionService | |
| Source: idlePingSubject.next() in CREATE_COMMIT_IDLE_PING_FN callback | |
| Frequency: Every tick while no signal is pending or scheduled</p> | |
| <p>Default implementation: Logs idle ping event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../interfaces/types.IdlePingContract.html" class="tsd-signature-type tsd-kind-interface">IdlePingContract</a></span><div class="tsd-comment tsd-typography"><p>Idle ping data with symbol, strategy info, current price, timestamp</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Implementation of IPublicAction.pingIdle</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25216">types.d.ts:25216</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="pingscheduled" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>ping<wbr/>Scheduled</span><a href="#pingscheduled" aria-label="Permalink" 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="pingscheduled-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">pingScheduled</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.SchedulePingContract.html" class="tsd-signature-type tsd-kind-interface">SchedulePingContract</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">source</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> <span class="tsd-signature-type">void</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="#pingscheduled-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>Handles scheduled ping events during scheduled signal monitoring.</p> | |
| <p>Called every minute while a scheduled signal is waiting for activation. | |
| Use to monitor pending signals and track wait time.</p> | |
| <p>Triggered by: ActionCoreService.pingScheduled() via StrategyConnectionService | |
| Source: schedulePingSubject.next() in CREATE_COMMIT_SCHEDULE_PING_FN callback | |
| Frequency: Every minute while scheduled signal is waiting</p> | |
| <p>Default implementation: Logs scheduled ping event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../interfaces/types.SchedulePingContract.html" class="tsd-signature-type tsd-kind-interface">SchedulePingContract</a></span><div class="tsd-comment tsd-typography"><p>Scheduled signal monitoring data with symbol, strategy info, signal data, timestamp</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-8" class="tsd-anchor"></a>Example<a href="#example-8" aria-label="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-0">pingScheduled</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">SchedulePingContract</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">waitTime</span><span class="hl-1"> = </span><span class="hl-0">getTimestamp</span><span class="hl-1">() - </span><span class="hl-5">event</span><span class="hl-1">.</span><span class="hl-5">data</span><span class="hl-1">.</span><span class="hl-5">timestampScheduled</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">waitMinutes</span><span class="hl-1"> = </span><span class="hl-5">Math</span><span class="hl-1">.</span><span class="hl-0">floor</span><span class="hl-1">(</span><span class="hl-5">waitTime</span><span class="hl-1"> / </span><span class="hl-7">60000</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Scheduled signal waiting </span><span class="hl-3">${</span><span class="hl-5">waitMinutes</span><span class="hl-3">}</span><span class="hl-2"> minutes`</span><span class="hl-1">);</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.pingScheduled</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25177">types.d.ts:25177</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="riskrejection" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>risk<wbr/>Rejection</span><a href="#riskrejection" aria-label="Permalink" 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="riskrejection-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">riskRejection</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.RiskContract.html" class="tsd-signature-type tsd-kind-interface">RiskContract</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">source</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> <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="#riskrejection-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>Handles risk rejection events when signals fail risk validation.</p> | |
| <p>Called only when signal is rejected (not emitted for allowed signals). | |
| Use to track rejected signals and analyze risk management effectiveness.</p> | |
| <p>Triggered by: ActionCoreService.riskRejection() via RiskConnectionService | |
| Source: riskSubject.next() in CREATE_COMMIT_REJECTION_FN callback | |
| Frequency: Only when signal fails risk validation</p> | |
| <p>Default implementation: Logs risk rejection event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../interfaces/types.RiskContract.html" class="tsd-signature-type tsd-kind-interface">RiskContract</a></span><div class="tsd-comment tsd-typography"><p>Risk rejection data with symbol, pending signal, rejection reason, timestamp</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-9" class="tsd-anchor"></a>Example<a href="#example-9" aria-label="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">async</span><span class="hl-1"> </span><span class="hl-0">riskRejection</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">RiskContract</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-3">this</span><span class="hl-1">.</span><span class="hl-5">telegram</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`[</span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">strategyName</span><span class="hl-3">}</span><span class="hl-2">] Signal rejected!</span><span class="hl-13">\n</span><span class="hl-2">`</span><span class="hl-1"> +</span><br/><span class="hl-1"> </span><span class="hl-2">`Reason: </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">rejectionNote</span><span class="hl-3">}</span><span class="hl-13">\n</span><span class="hl-2">`</span><span class="hl-1"> +</span><br/><span class="hl-1"> </span><span class="hl-2">`Active positions: </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">activePositionCount</span><span class="hl-3">}</span><span class="hl-2">`</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">metrics</span><span class="hl-1">.</span><span class="hl-0">recordRejection</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">.</span><span class="hl-5">rejectionId</span><span class="hl-1">);</span><br/><span class="hl-1">}</span> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.riskRejection</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25243">types.d.ts:25243</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="signal" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>signal</span><a href="#signal" aria-label="Permalink" 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="signal-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">signal</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.IStrategyTickResult.html" class="tsd-signature-type tsd-kind-type-alias">IStrategyTickResult</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">source</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> <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="#signal-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>Handles signal events from all modes (live + backtest).</p> | |
| <p>Called every tick/candle when strategy is evaluated. | |
| Receives all signal states: idle, scheduled, opened, active, closed, cancelled.</p> | |
| <p>Triggered by: ActionCoreService.signal() via StrategyConnectionService | |
| Source: signalEmitter.next() in tick() and backtest() methods | |
| Frequency: Every tick/candle</p> | |
| <p>Default implementation: Logs signal event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../types/types.IStrategyTickResult.html" class="tsd-signature-type tsd-kind-type-alias">IStrategyTickResult</a></span><div class="tsd-comment tsd-typography"><p>Signal state result with action, state, signal data, and context</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-10" class="tsd-anchor"></a>Example<a href="#example-10" aria-label="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-0">signal</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">IStrategyTickResult</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">event</span><span class="hl-1">.</span><span class="hl-5">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-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Signal opened: </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">signal</span><span class="hl-9">.</span><span class="hl-5">side</span><span class="hl-3">}</span><span class="hl-2"> at </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">signal</span><span class="hl-9">.</span><span class="hl-5">priceOpen</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-4">if</span><span class="hl-1"> (</span><span class="hl-5">event</span><span class="hl-1">.</span><span class="hl-5">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-5">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Signal closed: PNL </span><span class="hl-3">${</span><span class="hl-5">event</span><span class="hl-9">.</span><span class="hl-5">signal</span><span class="hl-9">.</span><span class="hl-5">revenue</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> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.signal</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25027">types.d.ts:25027</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="signalbacktest" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>signal<wbr/>Backtest</span><a href="#signalbacktest" aria-label="Permalink" 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="signalbacktest-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">signalBacktest</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.IStrategyTickResult.html" class="tsd-signature-type tsd-kind-type-alias">IStrategyTickResult</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">source</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> <span class="tsd-signature-type">void</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="#signalbacktest-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>Handles signal events from backtest only.</p> | |
| <p>Called every candle in backtest mode. | |
| Use for actions specific to backtesting (e.g., collecting test metrics).</p> | |
| <p>Triggered by: ActionCoreService.signalBacktest() via StrategyConnectionService | |
| Source: signalBacktestEmitter.next() in tick() and backtest() methods when backtest=true | |
| Frequency: Every candle in backtest mode</p> | |
| <p>Default implementation: Logs backtest signal event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../types/types.IStrategyTickResult.html" class="tsd-signature-type tsd-kind-type-alias">IStrategyTickResult</a></span><div class="tsd-comment tsd-typography"><p>Signal state result from backtest</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-11" class="tsd-anchor"></a>Example<a href="#example-11" aria-label="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-0">signalBacktest</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">IStrategyTickResult</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">event</span><span class="hl-1">.</span><span class="hl-5">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-3">this</span><span class="hl-1">.</span><span class="hl-5">backtestMetrics</span><span class="hl-1">.</span><span class="hl-0">recordTrade</span><span class="hl-1">(</span><span class="hl-5">event</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> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.signalBacktest</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25076">types.d.ts:25076</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="signallive" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>signal<wbr/>Live</span><a href="#signallive" aria-label="Permalink" 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="signallive-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">signalLive</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">event</span><span class="tsd-signature-symbol">:</span> <a href="../types/types.IStrategyTickResult.html" class="tsd-signature-type tsd-kind-type-alias">IStrategyTickResult</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">source</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> <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="#signallive-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>Handles signal events from live trading only.</p> | |
| <p>Called every tick in live mode. | |
| Use for actions that should only run in production (e.g., sending real notifications).</p> | |
| <p>Triggered by: ActionCoreService.signalLive() via StrategyConnectionService | |
| Source: signalLiveEmitter.next() in tick() and backtest() methods when backtest=false | |
| Frequency: Every tick in live mode</p> | |
| <p>Default implementation: Logs live signal event.</p> | |
| </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">event</span>: <a href="../types/types.IStrategyTickResult.html" class="tsd-signature-type tsd-kind-type-alias">IStrategyTickResult</a></span><div class="tsd-comment tsd-typography"><p>Signal state result from live trading</p> | |
| </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</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></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-12" class="tsd-anchor"></a>Example<a href="#example-12" aria-label="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">async</span><span class="hl-1"> </span><span class="hl-0">signalLive</span><span class="hl-1">(</span><span class="hl-5">event</span><span class="hl-1">: </span><span class="hl-5">IStrategyTickResult</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">event</span><span class="hl-1">.</span><span class="hl-5">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">await</span><span class="hl-1"> </span><span class="hl-3">this</span><span class="hl-1">.</span><span class="hl-5">telegram</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><span class="hl-2">'Real trade opened!'</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-3">this</span><span class="hl-1">.</span><span class="hl-0">placeRealOrder</span><span class="hl-1">(</span><span class="hl-5">event</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> | |
| </code><button type="button">Copy</button></pre> | |
| </div></div><aside class="tsd-sources"><p>Implementation of IPublicAction.signalLive</p><ul><li>Defined in <a href="https://github.com/tripolskypetr/backtest-kit/blob/b93fe7a5178c040a7a01701ecef340babde42e22/types.d.ts#L25052">types.d.ts:25052</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="#actionname" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>action<wbr/>Name</span></a><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="#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="#breakevenavailable" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>breakeven<wbr/>Available</span></a><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="#init" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>init</span></a><a href="#partiallossavailable" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>partial<wbr/>Loss<wbr/>Available</span></a><a href="#partialprofitavailable" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>partial<wbr/>Profit<wbr/>Available</span></a><a href="#pingactive" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>ping<wbr/>Active</span></a><a href="#pingidle" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>ping<wbr/>Idle</span></a><a href="#pingscheduled" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>ping<wbr/>Scheduled</span></a><a href="#riskrejection" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>risk<wbr/>Rejection</span></a><a href="#signal" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>signal</span></a><a href="#signalbacktest" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>signal<wbr/>Backtest</span></a><a href="#signallive" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>signal<wbr/>Live</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> | |
| <!-- Yandex.Metrika counter --> | |
| <script type="text/javascript"> | |
| (function(m,e,t,r,i,k,a){ | |
| m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; | |
| m[i].l=1*new Date(); | |
| for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }} | |
| k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a) | |
| })(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=105455585', 'ym'); | |
| ym(105455585, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", accurateTrackBounce:true, trackLinks:true}); | |
| </script> | |
| <noscript><div><img src="https://mc.yandex.ru/watch/105455585" style="position:absolute; left:-9999px;" alt="" /></div></noscript> | |
| <!-- /Yandex.Metrika counter --> | |
| <!-- Google tag (gtag.js) --> | |
| <script async src="https://www.googletagmanager.com/gtag/js?id=G-3MQZEBBDDR"></script> | |
| <script> | |
| window.dataLayer = window.dataLayer || []; | |
| function gtag(){dataLayer.push(arguments);} | |
| gtag('js', new Date()); | |
| gtag('config', 'G-3MQZEBBDDR'); | |
| </script> | |