TelegramAktienBot/documentation/frontend/components/BotSettingsComponent.html
2022-05-12 10:14:10 +02:00

900 lines
36 KiB
HTML

<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>aktienbot documentation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
<link rel="stylesheet" href="../styles/style.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top visible-xs">
<a href="../" class="navbar-brand">aktienbot documentation</a>
<button type="button" class="btn btn-default btn-menu fa fa-bars" id="btn-menu"></button>
</div>
<div class="xs-menu menu" id="mobile-menu">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search">
</div>
<nav>
<ul class="list">
<li class="title">
<a href="../">aktienbot documentation</a>
</li>
<li class="divider"></li>
<li class="chapter">
<a data-type="chapter-link" href="../"><span class="fa fa-home"></span>Getting started</a>
<ul class="links">
<li class="link">
<a href="../" ><span class="fa fa-file-text-o"></span>README</a>
</li>
<li class="link">
<a
href="../overview.html"
href="../overview.html"
>
<span class="fa fa-th"></span>Overview
</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="./modules.html" >
<span class="fa fa-archive"></span>
<span>Modules</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#xs-modules-links"
></span>
</a>
<ul class="links collapse in"
id="xs-modules-links"
>
<li class="link">
<a href="../modules/AppModule.html" >AppModule</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple">
<span class="fa fa-cogs"></span>
<span>Components</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#xs-components-links"
></span>
</div>
<ul class="links collapse in"
id="xs-components-links"
>
<li class="link">
<a href="../components/AppComponent.html" >AppComponent</a>
</li>
<li class="link">
<a href="../components/BotSettingsComponent.html" class="active" >BotSettingsComponent</a>
</li>
<li class="link">
<a href="../components/ConfirmationDialogComponent.html" >ConfirmationDialogComponent</a>
</li>
<li class="link">
<a href="../components/DashboardComponent.html" >DashboardComponent</a>
</li>
<li class="link">
<a href="../components/HeaderComponent.html" >HeaderComponent</a>
</li>
<li class="link">
<a href="../components/HelpDialogComponent.html" >HelpDialogComponent</a>
</li>
<li class="link">
<a href="../components/LoginComponent.html" >LoginComponent</a>
</li>
<li class="link">
<a href="../components/ProfileComponent.html" >ProfileComponent</a>
</li>
<li class="link">
<a href="../components/RegisterComponent.html" >RegisterComponent</a>
</li>
<li class="link">
<a href="../components/UserDialogComponent.html" >UserDialogComponent</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple">
<span class="fa fa-long-arrow-down"></span>
<span>Injectables</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#xs-injectables-links"
></span>
</div>
<ul class="links collapse in"
id="xs-injectables-links"
>
<li class="link">
<a href="../injectables/AuthInterceptor.html" >AuthInterceptor</a>
</li>
<li class="link">
<a href="../injectables/AuthService.html" >AuthService</a>
</li>
<li class="link">
<a href="../injectables/BotService.html" >BotService</a>
</li>
<li class="link">
<a href="../injectables/DataService.html" >DataService</a>
</li>
<li class="link">
<a href="../injectables/HelperService.html" >HelperService</a>
</li>
<li class="link">
<a href="../injectables/ProfileService.html" >ProfileService</a>
</li>
<li class="link">
<a href="../injectables/TokenStorageService.html" >TokenStorageService</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple">
<span class="fa fa-info"></span>
<span>Interfaces</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#xs-interfaces-links"
></span>
</div>
<ul class="links collapse in"
id="xs-interfaces-links"
>
<li class="link">
<a href="../interfaces/Keyword.html" >Keyword</a>
</li>
<li class="link">
<a href="../interfaces/Share.html" >Share</a>
</li>
<li class="link">
<a href="../interfaces/Stock.html" >Stock</a>
</li>
<li class="link">
<a href="../interfaces/TransactionData.html" >TransactionData</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../miscellaneous.html" ><span class="fa fa-cubes"></span>Miscellaneous</a>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>
<li class="divider"></li>
<li class="copyright">
Documentation generated using <a href="https://compodoc.github.io/compodoc/" target="_blank">
<img src="..//images/compodoc-vectorise.svg" class="img-responsive">
</a>
</li>
</ul>
</nav>
</div>
<div class="container-fluid main">
<div class="row main">
<div class="hidden-xs menu">
<nav>
<ul class="list">
<li class="title">
<a href="../">aktienbot documentation</a>
</li>
<li class="divider"></li>
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search">
</div>
<li class="chapter">
<a data-type="chapter-link" href="../"><span class="fa fa-home"></span>Getting started</a>
<ul class="links">
<li class="link">
<a href="../" ><span class="fa fa-file-text-o"></span>README</a>
</li>
<li class="link">
<a
href="../overview.html"
href="../overview.html"
>
<span class="fa fa-th"></span>Overview
</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="./modules.html" >
<span class="fa fa-archive"></span>
<span>Modules</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#modules-links"
></span>
</a>
<ul class="links collapse in"
id="modules-links"
>
<li class="link">
<a href="../modules/AppModule.html" >AppModule</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple">
<span class="fa fa-cogs"></span>
<span>Components</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#components-links"
></span>
</div>
<ul class="links collapse in"
id="components-links"
>
<li class="link">
<a href="../components/AppComponent.html" >AppComponent</a>
</li>
<li class="link">
<a href="../components/BotSettingsComponent.html" class="active" >BotSettingsComponent</a>
</li>
<li class="link">
<a href="../components/ConfirmationDialogComponent.html" >ConfirmationDialogComponent</a>
</li>
<li class="link">
<a href="../components/DashboardComponent.html" >DashboardComponent</a>
</li>
<li class="link">
<a href="../components/HeaderComponent.html" >HeaderComponent</a>
</li>
<li class="link">
<a href="../components/HelpDialogComponent.html" >HelpDialogComponent</a>
</li>
<li class="link">
<a href="../components/LoginComponent.html" >LoginComponent</a>
</li>
<li class="link">
<a href="../components/ProfileComponent.html" >ProfileComponent</a>
</li>
<li class="link">
<a href="../components/RegisterComponent.html" >RegisterComponent</a>
</li>
<li class="link">
<a href="../components/UserDialogComponent.html" >UserDialogComponent</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple">
<span class="fa fa-long-arrow-down"></span>
<span>Injectables</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#injectables-links"
></span>
</div>
<ul class="links collapse in"
id="injectables-links"
>
<li class="link">
<a href="../injectables/AuthInterceptor.html" >AuthInterceptor</a>
</li>
<li class="link">
<a href="../injectables/AuthService.html" >AuthService</a>
</li>
<li class="link">
<a href="../injectables/BotService.html" >BotService</a>
</li>
<li class="link">
<a href="../injectables/DataService.html" >DataService</a>
</li>
<li class="link">
<a href="../injectables/HelperService.html" >HelperService</a>
</li>
<li class="link">
<a href="../injectables/ProfileService.html" >ProfileService</a>
</li>
<li class="link">
<a href="../injectables/TokenStorageService.html" >TokenStorageService</a>
</li>
</ul>
</li>
<li class="chapter">
<div class="simple">
<span class="fa fa-info"></span>
<span>Interfaces</span>
<span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
data-target="#interfaces-links"
></span>
</div>
<ul class="links collapse in"
id="interfaces-links"
>
<li class="link">
<a href="../interfaces/Keyword.html" >Keyword</a>
</li>
<li class="link">
<a href="../interfaces/Share.html" >Share</a>
</li>
<li class="link">
<a href="../interfaces/Stock.html" >Stock</a>
</li>
<li class="link">
<a href="../interfaces/TransactionData.html" >TransactionData</a>
</li>
</ul>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../miscellaneous.html" ><span class="fa fa-cubes"></span>Miscellaneous</a>
</li>
<li class="chapter">
<a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
</li>
<li class="divider"></li>
<li class="copyright">
Documentation generated using <a href="https://compodoc.github.io/compodoc/" target="_blank">
<img src="..//images/compodoc-vectorise.svg" class="img-responsive">
</a>
</li>
</ul>
</nav>
</div>
<div class="content component">
<div class="content-data">
<ol class="breadcrumb">
<li>Components</li>
<li>BotSettingsComponent</li>
</ol>
<ul class="nav nav-tabs" role="tablist">
<li class="active">
<a href="#infos" id="infos-tab" role="tab" data-toggle="tab">Infos</a>
</li>
<li>
<a href="#source" role="tab" id="source-tab" data-toggle="tab">Source</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="infos"><p class="comment">
<h3>File</h3>
</p>
<p class="comment">
<code>src/app/Views/bot-settings/bot-settings.component.ts</code>
</p>
<section>
<h3>Metadata</h3>
<table class="table table-sm table-hover">
<tbody>
<tr>
<td class="col-md-3">selector</td>
<td class="col-md-9"><code>app-bot-settings</code></td>
</tr>
<tr>
<td class="col-md-3">styleUrls</td>
<td class="col-md-9"><code>bot-settings.component.scss</code></td>
</tr>
<tr>
<td class="col-md-3">templateUrl</td>
<td class="col-md-9"><code>bot-settings.component.html</code></td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="constructor">Constructor</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<code>constructor(botService: any, helper: any, profileService: any)</code>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="methods">Methods</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b><span class="modifier"></span> addKeyword</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon method fa fa-play ">
<span class="fa fa-"></span>
</span>
<code>addKeyword(event: MatChipInputEvent)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns: </b> <code>any</code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b><span class="modifier"></span> removeKeyword</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon method fa fa-play ">
<span class="fa fa-"></span>
</span>
<code>removeKeyword(keyword: Keyword)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns: </b> <code>any</code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b><span class="modifier"></span> addShare</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon method fa fa-play ">
<span class="fa fa-"></span>
</span>
<code>addShare(event: MatChipInputEvent)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns: </b> <code>any</code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b><span class="modifier"></span> removeShare</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon method fa fa-play ">
<span class="fa fa-"></span>
</span>
<code>removeShare(share: Share)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns: </b> <code>any</code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b> setCronString</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>setCronString()</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Returns: </b> <code>void</code>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3 id="inputs">Properties</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b> addOnBlur</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>addOnBlur: <code>boolean</code>
</bcode>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value: </i><code>true</code>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b> const</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>const: <code>any</code>
</bcode>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b> cronForm</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>cronForm: <code><a href="https://angular.io/docs/ts/latest/api/forms/index/FormControl-class.html" target="_blank" >FormControl</a></code>
</bcode>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b><span class="modifier">Public</span> cronOptions</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon fa fa-circle"></span><code>cronOptions: <code>CronOptions</code>
</bcode>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b> keywords</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>keywords: <code>Keyword[]</code>
</bcode>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b><span class="modifier"></span> separatorKeysCodes</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon fa fa-"></span><code>separatorKeysCodes: <code>any</code>
</bcode>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<b> shares</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>shares: <code>Share[]</code>
</bcode>
</td>
</tr>
</tbody>
</table>
</section>
</div>
<div class="tab-pane fade tab-source-code" id="source">
<pre><code class="hljs javascript">import { Component, OnInit } from &#x27;@angular/core&#x27;;
import { C, COMMA, ENTER, F } from &#x27;@angular/cdk/keycodes&#x27;;
import { MatChipInputEvent } from &#x27;@angular/material/chips&#x27;;
import { CronOptions } from &#x27;ngx-cron-editor&#x27;;
import { BotService } from &#x27;src/app/Services/bot.service&#x27;;
import { HelperService } from &#x27;src/app/Helpers/helper.service&#x27;;
import { ProfileService } from &#x27;src/app/Services/profile.service&#x27;;
import { FormControl } from &#x27;@angular/forms&#x27;;
export interface Share {
isin: string;
}
export interface Keyword {
name: string;
}
@Component({
selector: &#x27;app-bot-settings&#x27;,
templateUrl: &#x27;./bot-settings.component.html&#x27;,
styleUrls: [&#x27;./bot-settings.component.scss&#x27;],
})
export class BotSettingsComponent implements OnInit {
keywords: Keyword[] &#x3D; [];
shares: Share[] &#x3D; [];
constructor(
private botService: BotService,
private helper: HelperService,
private profileService: ProfileService
) {}
ngOnInit(): void {
this.shares &#x3D; this.helper.formatShareData();
this.keywords &#x3D; this.helper.formatKeywordsData();
}
addOnBlur &#x3D; true;
readonly separatorKeysCodes &#x3D; [ENTER, COMMA] as const;
async addKeyword(event: MatChipInputEvent): Promise&lt;void&gt; {
const value &#x3D; (event.value || &#x27;&#x27;).trim();
// Add keyword to database
if (value &amp;&amp; !this.keywords.includes({ name: value })) {
console.log(&#x27;Added: &#x27; + value);
this.botService.createKeyword(value.toLowerCase()).subscribe((result) &#x3D;&gt; {
console.log(result);
});
}
// Clear the input value
event.chipInput!.clear();
if (value) {
await this.helper.delay(1000);
this.keywords &#x3D; [];
this.keywords &#x3D; this.helper.formatKeywordsData();
}
}
async removeKeyword(keyword: Keyword): Promise&lt;void&gt; {
this.botService.deleteKeyword(keyword.name).subscribe((result) &#x3D;&gt; {
console.log(result);
});
await this.helper.delay(1000);
this.keywords &#x3D; [];
this.keywords &#x3D; this.helper.formatKeywordsData();
}
async addShare(event: MatChipInputEvent): Promise&lt;void&gt; {
const value &#x3D; (event.value || &#x27;&#x27;).trim();
// Add share to database
if (value &amp;&amp; !this.shares.includes({ isin: value.toLowerCase() })) {
console.log(&#x27;Added: &#x27; + value);
this.botService.createShare(value, &#x27;Comment&#x27;).subscribe((result) &#x3D;&gt; {
console.log(result);
});
}
// Clear the input value
event.chipInput!.clear();
if (value) {
await this.helper.delay(1000);
this.shares &#x3D; [];
this.shares &#x3D; this.helper.formatShareData();
}
}
async removeShare(share: Share): Promise&lt;void&gt; {
this.botService.deleteShare(share.isin).subscribe((result) &#x3D;&gt; {
console.log(result);
});
await this.helper.delay(1000);
this.shares &#x3D; [];
this.shares &#x3D; this.helper.formatShareData();
}
setCronString() {
this.profileService
.addCronString(this.cronForm.value)
.subscribe((result) &#x3D;&gt; {
console.log(result);
});
}
cronForm &#x3D; new FormControl(&#x27;0 0 1/1 * *&#x27;);
public cronOptions: CronOptions &#x3D; {
defaultTime: &#x27;00:00:00&#x27;,
hideMinutesTab: true,
hideHourlyTab: true,
hideDailyTab: false,
hideWeeklyTab: true,
hideMonthlyTab: true,
hideYearlyTab: true,
hideAdvancedTab: true,
hideSpecificWeekDayTab: true,
hideSpecificMonthWeekTab: true,
use24HourTime: true,
hideSeconds: true,
cronFlavor: &#x27;quartz&#x27;, //standard or quartz
};
}
</code></pre>
</div>
</div>
</div><div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
<script src="../js/libs/bootstrap-native.js"></script>
<script src="../js/libs/es6-shim.min.js"></script>
<script src="../js/libs/EventDispatcher.js"></script>
<script src="../js/libs/promise.min.js"></script>
<script src="../js/libs/zepto.min.js"></script>
<script src="../js/compodoc.js"></script>
<script src="../js/search/search.js"></script>
<script src="../js/search/lunr.min.js"></script>
<script src="../js/search/search-lunr.js"></script>
<script src="../js/menu.js"></script>
<script src="../js/libs/highlight.pack.js"></script>
<script src="../js/libs/highlightjs-line-numbers.min.js"></script>
<script src="../js/search/search_index.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
hljs.initHighlightingOnLoad();
hljs.initLineNumbersOnLoad();
});
</script>
</body>
</html>