commit
14a84230e1
50
frontend/.eslintrc.json
Normal file
50
frontend/.eslintrc.json
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"ignorePatterns": [
|
||||||
|
"projects/**/*"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.ts"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"tsconfig.json"
|
||||||
|
],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:@angular-eslint/recommended",
|
||||||
|
"plugin:@angular-eslint/template/process-inline-templates"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@angular-eslint/directive-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "attribute",
|
||||||
|
"prefix": "app",
|
||||||
|
"style": "camelCase"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/component-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "element",
|
||||||
|
"prefix": "app",
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.html"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"plugin:@angular-eslint/template/recommended"
|
||||||
|
],
|
||||||
|
"rules": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -26,7 +26,10 @@
|
|||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
"assets": ["src/favicon.ico", "src/assets"],
|
"assets": [
|
||||||
|
"src/favicon.png",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
|
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
@ -92,16 +95,31 @@
|
|||||||
"tsConfig": "tsconfig.spec.json",
|
"tsConfig": "tsconfig.spec.json",
|
||||||
"karmaConfig": "karma.conf.js",
|
"karmaConfig": "karma.conf.js",
|
||||||
"inlineStyleLanguage": "scss",
|
"inlineStyleLanguage": "scss",
|
||||||
"assets": ["src/favicon.ico", "src/assets"],
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": []
|
"scripts": []
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-eslint/builder:lint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.html"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultProject": "Aktienbot"
|
"defaultProject": "Aktienbot",
|
||||||
|
"cli": {
|
||||||
|
"defaultCollection": "@angular-eslint/schematics"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
4583
frontend/package-lock.json
generated
4583
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,8 @@
|
|||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"watch": "ng build --watch --configuration development",
|
"watch": "ng build --watch --configuration development",
|
||||||
"test": "ng test"
|
"test": "ng test",
|
||||||
|
"lint": "ng lint"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -16,28 +17,36 @@
|
|||||||
"@angular/compiler": "~13.2.0",
|
"@angular/compiler": "~13.2.0",
|
||||||
"@angular/core": "~13.2.0",
|
"@angular/core": "~13.2.0",
|
||||||
"@angular/forms": "~13.2.0",
|
"@angular/forms": "~13.2.0",
|
||||||
"@angular/material": "^13.3.5",
|
"@angular/material": "^13.2.6",
|
||||||
"@angular/platform-browser": "~13.2.0",
|
"@angular/platform-browser": "~13.2.0",
|
||||||
"@angular/platform-browser-dynamic": "~13.2.0",
|
"@angular/platform-browser-dynamic": "~13.2.0",
|
||||||
"@angular/router": "~13.2.0",
|
"@angular/router": "~13.2.0",
|
||||||
"bootstrap": "^5.1.3",
|
"bootstrap": "^5.1.3",
|
||||||
"ngx-cron-editor": "^0.7.3",
|
"ngx-cron-editor": "^0.7.3",
|
||||||
"rxjs": "~7.5.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.4.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.11.4"
|
"zone.js": "~0.11.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~13.3.4",
|
"@angular-devkit/build-angular": "~13.2.5",
|
||||||
"@angular/cli": "~13.3.4",
|
"@angular-eslint/builder": "13.2.1",
|
||||||
|
"@angular-eslint/eslint-plugin": "13.2.1",
|
||||||
|
"@angular-eslint/eslint-plugin-template": "13.2.1",
|
||||||
|
"@angular-eslint/schematics": "13.2.1",
|
||||||
|
"@angular-eslint/template-parser": "13.2.1",
|
||||||
|
"@angular/cli": "~13.2.5",
|
||||||
"@angular/compiler-cli": "~13.2.0",
|
"@angular/compiler-cli": "~13.2.0",
|
||||||
"@types/jasmine": "~4.0.3",
|
"@types/jasmine": "~3.10.0",
|
||||||
"@types/node": "^17.0.29",
|
"@types/node": "^12.11.1",
|
||||||
"karma": "~6.3.19",
|
"@typescript-eslint/eslint-plugin": "5.17.0",
|
||||||
"jasmine-core": "~4.1.0",
|
"@typescript-eslint/parser": "5.17.0",
|
||||||
|
"eslint": "^8.12.0",
|
||||||
|
"jasmine-core": "~4.0.0",
|
||||||
|
"karma": "~6.3.0",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
"karma-coverage": "~2.2.0",
|
"karma-coverage": "~2.1.0",
|
||||||
"karma-jasmine": "~5.0.0",
|
"karma-jasmine": "~4.0.0",
|
||||||
"karma-jasmine-html-reporter": "~1.7.0",
|
"karma-jasmine-html-reporter": "~1.7.0",
|
||||||
"typescript": "~4.5.2"
|
"typescript": "~4.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ export class HelperService {
|
|||||||
var data = JSON.parse(result);
|
var data = JSON.parse(result);
|
||||||
for (let i = 0; i < data.data.length; i++) {
|
for (let i = 0; i < data.data.length; i++) {
|
||||||
shares.push({
|
shares.push({
|
||||||
symbol: data.data[i].symbol,
|
isin: data.data[i].isin,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -79,11 +79,12 @@ export class BotService {
|
|||||||
* @param {string} keyword
|
* @param {string} keyword
|
||||||
* @returns Observable
|
* @returns Observable
|
||||||
*/
|
*/
|
||||||
public createShare(symbol: string): Observable<any> {
|
public createShare(isin: string, comment: string): Observable<any> {
|
||||||
return this.http.post(
|
return this.http.post(
|
||||||
API_URL + 'share',
|
API_URL + 'share',
|
||||||
{
|
{
|
||||||
symbol,
|
comment,
|
||||||
|
isin,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: new HttpHeaders({
|
headers: new HttpHeaders({
|
||||||
|
@ -50,7 +50,8 @@ export class DataService {
|
|||||||
* @returns Observable
|
* @returns Observable
|
||||||
*/
|
*/
|
||||||
public createTransaction(
|
public createTransaction(
|
||||||
symbol: string,
|
comment: string,
|
||||||
|
isin: string,
|
||||||
time: string,
|
time: string,
|
||||||
count: number,
|
count: number,
|
||||||
price: number
|
price: number
|
||||||
@ -60,9 +61,10 @@ export class DataService {
|
|||||||
return this.http.post(
|
return this.http.post(
|
||||||
API_URL + 'transaction',
|
API_URL + 'transaction',
|
||||||
{
|
{
|
||||||
|
comment,
|
||||||
count,
|
count,
|
||||||
|
isin,
|
||||||
price,
|
price,
|
||||||
symbol,
|
|
||||||
time,
|
time,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<mat-grid-list cols="2">
|
<mat-grid-list cols="2" rowHeight="45%">
|
||||||
<mat-grid-tile>
|
<mat-grid-tile colspan="1" rowspan="1">
|
||||||
<mat-card class="card">
|
<mat-card class="card">
|
||||||
<mat-card-title class="card-title">Keywords</mat-card-title>
|
<mat-card-title class="card-title">Keywords</mat-card-title>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
@ -31,7 +31,32 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</mat-grid-tile>
|
</mat-grid-tile>
|
||||||
<mat-grid-tile>
|
<mat-grid-tile colspan="1" rowspan="2">
|
||||||
|
<mat-card class="card placeholderRHS">
|
||||||
|
<mat-card-title class="card-title">
|
||||||
|
<span>Add automatic updates</span>
|
||||||
|
</mat-card-title>
|
||||||
|
<mat-card-content class="cron-content">
|
||||||
|
<form
|
||||||
|
name="form"
|
||||||
|
(ngSubmit)="f.form.valid && setCronString()"
|
||||||
|
#f="ngForm"
|
||||||
|
novalidate
|
||||||
|
class="backgorund form"
|
||||||
|
>
|
||||||
|
<cron-editor
|
||||||
|
class="cron-editor"
|
||||||
|
[formControl]="cronForm"
|
||||||
|
[options]="cronOptions"
|
||||||
|
></cron-editor>
|
||||||
|
<div class="form-group footer-buttons">
|
||||||
|
<button class="btn btn-primary btn-block">Add</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
</mat-grid-tile>
|
||||||
|
<mat-grid-tile colspan="1" rowspan="1">
|
||||||
<mat-card class="card">
|
<mat-card class="card">
|
||||||
<mat-card-title class="card-title">Shares</mat-card-title>
|
<mat-card-title class="card-title">Shares</mat-card-title>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
@ -42,7 +67,7 @@
|
|||||||
*ngFor="let share of shares"
|
*ngFor="let share of shares"
|
||||||
(removed)="removeShare(share)"
|
(removed)="removeShare(share)"
|
||||||
>
|
>
|
||||||
{{ share.symbol }}
|
{{ share.isin }}
|
||||||
<button matChipRemove>
|
<button matChipRemove>
|
||||||
<mat-icon>cancel</mat-icon>
|
<mat-icon>cancel</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
@ -24,3 +24,20 @@ mat-grid {
|
|||||||
.example-chip-list {
|
.example-chip-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
height: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placeholderRHS {
|
||||||
|
height: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cron-content {
|
||||||
|
height: 70%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-card {
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { C, COMMA, ENTER, F } from '@angular/cdk/keycodes';
|
import { C, COMMA, ENTER, F } from '@angular/cdk/keycodes';
|
||||||
import { MatChipInputEvent } from '@angular/material/chips';
|
import { MatChipInputEvent } from '@angular/material/chips';
|
||||||
|
|
||||||
|
import { CronOptions } from 'ngx-cron-editor';
|
||||||
|
|
||||||
import { BotService } from 'src/app/Services/bot.service';
|
import { BotService } from 'src/app/Services/bot.service';
|
||||||
import { HelperService } from 'src/app/Helpers/helper.service';
|
import { HelperService } from 'src/app/Helpers/helper.service';
|
||||||
|
import { ProfileService } from 'src/app/Services/profile.service';
|
||||||
|
import { FormControl } from '@angular/forms';
|
||||||
|
|
||||||
export interface Fruit {
|
export interface Fruit {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Share {
|
export interface Share {
|
||||||
symbol: string;
|
isin: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Keyword {
|
export interface Keyword {
|
||||||
@ -25,7 +30,11 @@ export class BotSettingsComponent implements OnInit {
|
|||||||
keywords: Keyword[] = [];
|
keywords: Keyword[] = [];
|
||||||
shares: Share[] = [];
|
shares: Share[] = [];
|
||||||
|
|
||||||
constructor(private botService: BotService, private helper: HelperService) {}
|
constructor(
|
||||||
|
private botService: BotService,
|
||||||
|
private helper: HelperService,
|
||||||
|
private profileService: ProfileService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.shares = this.helper.formatShareData();
|
this.shares = this.helper.formatShareData();
|
||||||
@ -41,7 +50,7 @@ export class BotSettingsComponent implements OnInit {
|
|||||||
// Add keyword to database
|
// Add keyword to database
|
||||||
if (value && !this.keywords.includes({ name: value })) {
|
if (value && !this.keywords.includes({ name: value })) {
|
||||||
console.log('Added: ' + value);
|
console.log('Added: ' + value);
|
||||||
this.botService.createKeyword(value).subscribe((result) => {
|
this.botService.createKeyword(value.toLowerCase()).subscribe((result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -71,9 +80,9 @@ export class BotSettingsComponent implements OnInit {
|
|||||||
const value = (event.value || '').trim();
|
const value = (event.value || '').trim();
|
||||||
|
|
||||||
// Add share to database
|
// Add share to database
|
||||||
if (value && !this.shares.includes({ symbol: value })) {
|
if (value && !this.shares.includes({ isin: value.toLowerCase() })) {
|
||||||
console.log('Added: ' + value);
|
console.log('Added: ' + value);
|
||||||
this.botService.createShare(value).subscribe((result) => {
|
this.botService.createShare(value, 'Comment').subscribe((result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -90,7 +99,7 @@ export class BotSettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async removeShare(share: Share): Promise<void> {
|
async removeShare(share: Share): Promise<void> {
|
||||||
this.botService.deleteShare(share.symbol).subscribe((result) => {
|
this.botService.deleteShare(share.isin).subscribe((result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -99,4 +108,32 @@ export class BotSettingsComponent implements OnInit {
|
|||||||
this.shares = [];
|
this.shares = [];
|
||||||
this.shares = this.helper.formatShareData();
|
this.shares = this.helper.formatShareData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCronString() {
|
||||||
|
this.profileService
|
||||||
|
.addCronString(this.cronForm.value)
|
||||||
|
.subscribe((result) => {
|
||||||
|
console.log(result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cronForm = new FormControl('0 0 1/1 * *');
|
||||||
|
public cronOptions: CronOptions = {
|
||||||
|
defaultTime: '00:00:00',
|
||||||
|
|
||||||
|
hideMinutesTab: true,
|
||||||
|
hideHourlyTab: true,
|
||||||
|
hideDailyTab: false,
|
||||||
|
hideWeeklyTab: true,
|
||||||
|
hideMonthlyTab: true,
|
||||||
|
hideYearlyTab: true,
|
||||||
|
hideAdvancedTab: true,
|
||||||
|
hideSpecificWeekDayTab: true,
|
||||||
|
hideSpecificMonthWeekTab: true,
|
||||||
|
|
||||||
|
use24HourTime: true,
|
||||||
|
hideSeconds: true,
|
||||||
|
|
||||||
|
cronFlavor: 'quartz', //standard or quartz
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,12 @@
|
|||||||
<td mat-cell *matCellDef="let element">{{ element.count }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.count }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Comment Column -->
|
||||||
|
<ng-container matColumnDef="comment">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Comment</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.comment }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
<!-- Name Column -->
|
<!-- Name Column -->
|
||||||
<ng-container matColumnDef="name">
|
<ng-container matColumnDef="name">
|
||||||
<th mat-header-cell *matHeaderCellDef>Price</th>
|
<th mat-header-cell *matHeaderCellDef>Price</th>
|
||||||
@ -131,8 +137,8 @@
|
|||||||
|
|
||||||
<!-- Weight Column -->
|
<!-- Weight Column -->
|
||||||
<ng-container matColumnDef="weight">
|
<ng-container matColumnDef="weight">
|
||||||
<th mat-header-cell *matHeaderCellDef>Symbol</th>
|
<th mat-header-cell *matHeaderCellDef>ISIN</th>
|
||||||
<td mat-cell *matCellDef="let element">{{ element.symbol }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.isin }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Symbol Column -->
|
<!-- Symbol Column -->
|
||||||
|
@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { DataService } from 'src/app/Services/data.service';
|
import { DataService } from 'src/app/Services/data.service';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { UserDialogComponent } from './user-dialog/user-dialog.component';
|
import { UserDialogComponent } from './user-dialog/user-dialog.component';
|
||||||
import { C } from '@angular/cdk/keycodes';
|
|
||||||
import { HelperService } from 'src/app/Helpers/helper.service';
|
import { HelperService } from 'src/app/Helpers/helper.service';
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
@ -31,7 +30,8 @@ var TRANSACTION_DATA: TransactionData[] = [];
|
|||||||
var STOCK_DATA: Stock[] = [];
|
var STOCK_DATA: Stock[] = [];
|
||||||
|
|
||||||
export interface TransactionData {
|
export interface TransactionData {
|
||||||
symbol: string;
|
comment: string;
|
||||||
|
isin: string;
|
||||||
time: string;
|
time: string;
|
||||||
count: number;
|
count: number;
|
||||||
price: number;
|
price: number;
|
||||||
@ -44,8 +44,8 @@ export interface TransactionData {
|
|||||||
})
|
})
|
||||||
export class DashboardComponent implements OnInit {
|
export class DashboardComponent implements OnInit {
|
||||||
constructor(
|
constructor(
|
||||||
private helper: HelperService,
|
|
||||||
private dataService: DataService,
|
private dataService: DataService,
|
||||||
|
private helper: HelperService,
|
||||||
public dialog: MatDialog
|
public dialog: MatDialog
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -55,11 +55,34 @@ export class DashboardComponent implements OnInit {
|
|||||||
depotCost: number = 0;
|
depotCost: number = 0;
|
||||||
profit: number = 0;
|
profit: number = 0;
|
||||||
|
|
||||||
|
getTransactions() {
|
||||||
|
var TRANSACTION_DATA: TransactionData[] = [];
|
||||||
|
this.dataService.getTransactionData().subscribe((response: any) => {
|
||||||
|
var data = JSON.parse(response);
|
||||||
|
this.depotCost = 0;
|
||||||
|
for (let i = 0; i < data.data.length; i++) {
|
||||||
|
this.depotCost += data.data[i].price;
|
||||||
|
TRANSACTION_DATA.push({
|
||||||
|
comment: data.data[i].comment,
|
||||||
|
isin: data.data[i].isin,
|
||||||
|
time: data.data[i].time,
|
||||||
|
count: data.data[i].count,
|
||||||
|
price: data.data[i].price,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.dataSourceTransactions = TRANSACTION_DATA;
|
||||||
|
//TODO move to helper service
|
||||||
|
|
||||||
|
this.profit = this.depotCurrentValue - this.depotCost;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.dataService.getStockData().subscribe((response: any) => {
|
this.dataService.getStockData().subscribe((response: any) => {
|
||||||
var data = JSON.parse(response);
|
var data = JSON.parse(response);
|
||||||
|
this.depotCurrentValue = 0;
|
||||||
for (let i = 0; i < data.data.length; i++) {
|
for (let i = 0; i < data.data.length; i++) {
|
||||||
this.depotCurrentValue += data.data[i].current_price;
|
this.depotCurrentValue = data.data[i].current_price;
|
||||||
STOCK_DATA.push({
|
STOCK_DATA.push({
|
||||||
count: data.data[i].count,
|
count: data.data[i].count,
|
||||||
currentPrice: data.data[i].current_price,
|
currentPrice: data.data[i].current_price,
|
||||||
@ -75,10 +98,12 @@ export class DashboardComponent implements OnInit {
|
|||||||
|
|
||||||
this.dataService.getTransactionData().subscribe((response: any) => {
|
this.dataService.getTransactionData().subscribe((response: any) => {
|
||||||
var data = JSON.parse(response);
|
var data = JSON.parse(response);
|
||||||
|
this.depotCost = 0;
|
||||||
for (let i = 0; i < data.data.length; i++) {
|
for (let i = 0; i < data.data.length; i++) {
|
||||||
this.depotCost += data.data[i].price;
|
this.depotCost += data.data[i].price;
|
||||||
TRANSACTION_DATA.push({
|
TRANSACTION_DATA.push({
|
||||||
symbol: data.data[i].symbol,
|
comment: data.data[i].comment,
|
||||||
|
isin: data.data[i].isin,
|
||||||
time: data.data[i].time,
|
time: data.data[i].time,
|
||||||
count: data.data[i].count,
|
count: data.data[i].count,
|
||||||
price: data.data[i].price,
|
price: data.data[i].price,
|
||||||
@ -91,7 +116,8 @@ export class DashboardComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol: string = '';
|
comment: string = '';
|
||||||
|
isin: string = '';
|
||||||
time: Date = new Date();
|
time: Date = new Date();
|
||||||
count: number = 0.0;
|
count: number = 0.0;
|
||||||
price: number = 0.0;
|
price: number = 0.0;
|
||||||
@ -100,7 +126,8 @@ export class DashboardComponent implements OnInit {
|
|||||||
const dialogRef = this.dialog.open(UserDialogComponent, {
|
const dialogRef = this.dialog.open(UserDialogComponent, {
|
||||||
width: '50vw',
|
width: '50vw',
|
||||||
data: {
|
data: {
|
||||||
symbol: this.symbol,
|
comment: this.comment,
|
||||||
|
isin: this.isin,
|
||||||
time: this.time,
|
time: this.time,
|
||||||
count: this.count,
|
count: this.count,
|
||||||
price: this.price,
|
price: this.price,
|
||||||
@ -108,11 +135,18 @@ export class DashboardComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe((result) => {
|
dialogRef.afterClosed().subscribe((result) => {
|
||||||
console.log('The dialog was closed');
|
this.helper.delay(1000);
|
||||||
|
this.getTransactions();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
displayedColumns: string[] = ['weight', 'position', 'name', 'symbol'];
|
displayedColumns: string[] = [
|
||||||
|
'comment',
|
||||||
|
'weight',
|
||||||
|
'position',
|
||||||
|
'name',
|
||||||
|
'symbol',
|
||||||
|
];
|
||||||
displayedColumnsStocks: string[] = [
|
displayedColumnsStocks: string[] = [
|
||||||
'position',
|
'position',
|
||||||
'name',
|
'name',
|
||||||
|
@ -7,15 +7,27 @@
|
|||||||
class="backgorund"
|
class="backgorund"
|
||||||
>
|
>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="symbol">Symbol</label>
|
<label for="comment">Comment</label>
|
||||||
<input
|
<input
|
||||||
type="symbol"
|
type="comment"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
name="symbol"
|
name="comment"
|
||||||
[(ngModel)]="data.symbol"
|
[(ngModel)]="data.comment"
|
||||||
required
|
required
|
||||||
symbol
|
comment
|
||||||
#symbol="ngModel"
|
#comment="ngModel"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="isin">isin</label>
|
||||||
|
<input
|
||||||
|
type="isin"
|
||||||
|
class="form-control"
|
||||||
|
name="isin"
|
||||||
|
[(ngModel)]="data.isin"
|
||||||
|
required
|
||||||
|
isin
|
||||||
|
#isin="ngModel"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -13,7 +13,7 @@ import { TransactionData } from '../dashboard.component';
|
|||||||
templateUrl: './user-dialog.component.html',
|
templateUrl: './user-dialog.component.html',
|
||||||
styleUrls: ['./user-dialog.component.scss'],
|
styleUrls: ['./user-dialog.component.scss'],
|
||||||
})
|
})
|
||||||
export class UserDialogComponent implements OnInit {
|
export class UserDialogComponent {
|
||||||
constructor(
|
constructor(
|
||||||
private dataService: DataService,
|
private dataService: DataService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
@ -21,14 +21,13 @@ export class UserDialogComponent implements OnInit {
|
|||||||
@Inject(MAT_DIALOG_DATA) public data: TransactionData
|
@Inject(MAT_DIALOG_DATA) public data: TransactionData
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
//TODO check tat price is decimal
|
//TODO check that price is decimal
|
||||||
console.log(
|
console.log(
|
||||||
this.dataService
|
this.dataService
|
||||||
.createTransaction(
|
.createTransaction(
|
||||||
this.data.symbol,
|
this.data.comment,
|
||||||
|
this.data.isin,
|
||||||
this.data.time,
|
this.data.time,
|
||||||
+this.data.count,
|
+this.data.count,
|
||||||
+this.data.price.toFixed(2)
|
+this.data.price.toFixed(2)
|
||||||
|
@ -6,14 +6,12 @@ import { TokenStorageService } from 'src/app/Services/token.service';
|
|||||||
templateUrl: './header.component.html',
|
templateUrl: './header.component.html',
|
||||||
styleUrls: ['./header.component.scss'],
|
styleUrls: ['./header.component.scss'],
|
||||||
})
|
})
|
||||||
export class HeaderComponent implements OnInit {
|
export class HeaderComponent {
|
||||||
/**
|
/**
|
||||||
* @param {TokenStorageService} privatetokenStorage
|
* @param {TokenStorageService} privatetokenStorage
|
||||||
*/
|
*/
|
||||||
constructor(private tokenStorage: TokenStorageService) {}
|
constructor(private tokenStorage: TokenStorageService) {}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
//logout() clears session storage; All user data is eradicated from it and page is reloaded
|
//logout() clears session storage; All user data is eradicated from it and page is reloaded
|
||||||
logout() {
|
logout() {
|
||||||
this.tokenStorage.signOut();
|
this.tokenStorage.signOut();
|
||||||
|
@ -5,11 +5,9 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
templateUrl: './confirmation-dialog.component.html',
|
templateUrl: './confirmation-dialog.component.html',
|
||||||
styleUrls: ['./confirmation-dialog.component.scss'],
|
styleUrls: ['./confirmation-dialog.component.scss'],
|
||||||
})
|
})
|
||||||
export class ConfirmationDialogComponent implements OnInit {
|
export class ConfirmationDialogComponent {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
confirm() {}
|
confirm() {}
|
||||||
|
|
||||||
returnBack() {}
|
returnBack() {}
|
||||||
|
@ -5,10 +5,8 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
templateUrl: './help-dialog.component.html',
|
templateUrl: './help-dialog.component.html',
|
||||||
styleUrls: ['./help-dialog.component.scss'],
|
styleUrls: ['./help-dialog.component.scss'],
|
||||||
})
|
})
|
||||||
export class HelpDialogComponent implements OnInit {
|
export class HelpDialogComponent {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
close() {}
|
close() {}
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,8 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</mat-grid-tile>
|
</mat-grid-tile>
|
||||||
<mat-grid-tile colspan="1" rowspan="1">
|
<mat-grid-tile colspan="1" rowspan="2">
|
||||||
<mat-card class="card placeholderRHS">
|
<mat-card class="card placeholder">
|
||||||
<mat-card-title class="card-title">
|
<mat-card-title class="card-title">
|
||||||
<span>Connect Telegram Account</span>
|
<span>Connect Telegram Account</span>
|
||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
@ -137,29 +137,4 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</mat-grid-tile>
|
</mat-grid-tile>
|
||||||
<mat-grid-tile colspan="1" rowspan="1">
|
|
||||||
<mat-card class="card placeholderRHS">
|
|
||||||
<mat-card-title class="card-title">
|
|
||||||
<span>Add automatic updates</span>
|
|
||||||
</mat-card-title>
|
|
||||||
<mat-card-content class="cron-content">
|
|
||||||
<form
|
|
||||||
name="form"
|
|
||||||
(ngSubmit)="f.form.valid && setCronString()"
|
|
||||||
#f="ngForm"
|
|
||||||
novalidate
|
|
||||||
class="backgorund form"
|
|
||||||
>
|
|
||||||
<cron-editor
|
|
||||||
class="cron-editor"
|
|
||||||
[formControl]="cronForm"
|
|
||||||
[options]="cronOptions"
|
|
||||||
></cron-editor>
|
|
||||||
<div class="form-group footer-buttons">
|
|
||||||
<button class="btn btn-primary btn-block">Add</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</mat-card-content>
|
|
||||||
</mat-card>
|
|
||||||
</mat-grid-tile>
|
|
||||||
</mat-grid-list>
|
</mat-grid-list>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormControl, PatternValidator, Validators } from '@angular/forms';
|
import { FormControl, Validators } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { CronOptions } from 'ngx-cron-editor';
|
|
||||||
import { ProfileService } from 'src/app/Services/profile.service';
|
import { ProfileService } from 'src/app/Services/profile.service';
|
||||||
import { ConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component';
|
||||||
import { HelpDialogComponent } from './help-dialog/help-dialog.component';
|
import { HelpDialogComponent } from './help-dialog/help-dialog.component';
|
||||||
@ -32,26 +31,6 @@ export class ProfileComponent implements OnInit {
|
|||||||
public dialog: MatDialog
|
public dialog: MatDialog
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
cronForm = new FormControl('0 0 1/1 * *');
|
|
||||||
public cronOptions: CronOptions = {
|
|
||||||
defaultTime: '00:00:00',
|
|
||||||
|
|
||||||
hideMinutesTab: true,
|
|
||||||
hideHourlyTab: true,
|
|
||||||
hideDailyTab: false,
|
|
||||||
hideWeeklyTab: true,
|
|
||||||
hideMonthlyTab: true,
|
|
||||||
hideYearlyTab: true,
|
|
||||||
hideAdvancedTab: true,
|
|
||||||
hideSpecificWeekDayTab: true,
|
|
||||||
hideSpecificMonthWeekTab: true,
|
|
||||||
|
|
||||||
use24HourTime: true,
|
|
||||||
hideSeconds: true,
|
|
||||||
|
|
||||||
cronFlavor: 'quartz', //standard or quartz
|
|
||||||
};
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.profileService.getUserData().subscribe((result) => {
|
this.profileService.getUserData().subscribe((result) => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
@ -98,14 +77,6 @@ export class ProfileComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setCronString() {
|
|
||||||
this.profileService
|
|
||||||
.addCronString(this.cronForm.value)
|
|
||||||
.subscribe((result) => {
|
|
||||||
console.log(result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
openHelp() {
|
openHelp() {
|
||||||
const dialogRef = this.dialog.open(HelpDialogComponent, {
|
const dialogRef = this.dialog.open(HelpDialogComponent, {
|
||||||
width: '50vw',
|
width: '50vw',
|
||||||
|
@ -7,7 +7,7 @@ import { AuthService } from '../../Services/auth.service';
|
|||||||
templateUrl: './register.component.html',
|
templateUrl: './register.component.html',
|
||||||
styleUrls: ['./register.component.scss'],
|
styleUrls: ['./register.component.scss'],
|
||||||
})
|
})
|
||||||
export class RegisterComponent implements OnInit {
|
export class RegisterComponent {
|
||||||
form: any = {
|
form: any = {
|
||||||
email: null,
|
email: null,
|
||||||
password: null,
|
password: null,
|
||||||
@ -22,7 +22,6 @@ export class RegisterComponent implements OnInit {
|
|||||||
* @param {Router} privaterouter
|
* @param {Router} privaterouter
|
||||||
*/
|
*/
|
||||||
constructor(private authService: AuthService, private router: Router) {}
|
constructor(private authService: AuthService, private router: Router) {}
|
||||||
ngOnInit(): void {}
|
|
||||||
onSubmit(): void {
|
onSubmit(): void {
|
||||||
const { email, username, password } = this.form;
|
const { email, username, password } = this.form;
|
||||||
this.authService.register(email, username, password).subscribe(
|
this.authService.register(email, username, password).subscribe(
|
||||||
|
BIN
frontend/src/assets/favicon.png
Normal file
BIN
frontend/src/assets/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 600 B |
Binary file not shown.
Before Width: | Height: | Size: 948 B |
@ -6,6 +6,7 @@
|
|||||||
<base href="/" />
|
<base href="/" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||||
|
<link rel="icon" type="image/x-icon" href="assets/favicon.png" />
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
|
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
|
Loading…
Reference in New Issue
Block a user