diff --git a/frontend/src/app/Helpers/helper.service.ts b/frontend/src/app/Helpers/helper.service.ts index 24d485e..60a57c6 100644 --- a/frontend/src/app/Helpers/helper.service.ts +++ b/frontend/src/app/Helpers/helper.service.ts @@ -28,7 +28,8 @@ export class HelperService { return shares; } - formatKeywordsData(keywords: Keyword[]) { + formatKeywordsData(): Keyword[] { + var keywords: Keyword[] = []; this.botService.getKeywords().subscribe((result) => { var data = JSON.parse(result); for (let i = 0; i < data.data.length; i++) { diff --git a/frontend/src/app/Views/bot-settings/bot-settings.component.html b/frontend/src/app/Views/bot-settings/bot-settings.component.html index cee4a8a..8318bb9 100644 --- a/frontend/src/app/Views/bot-settings/bot-settings.component.html +++ b/frontend/src/app/Views/bot-settings/bot-settings.component.html @@ -44,7 +44,7 @@ { diff --git a/frontend/src/app/Views/dashboard/dashboard.component.html b/frontend/src/app/Views/dashboard/dashboard.component.html index b52475f..509ebbe 100644 --- a/frontend/src/app/Views/dashboard/dashboard.component.html +++ b/frontend/src/app/Views/dashboard/dashboard.component.html @@ -3,7 +3,7 @@ - Aktienübersicht + Stocks @@ -51,16 +51,55 @@ - Depotübersicht + Depot - + + + + + + Portfolio Value + + + + + Portfolio Cost + + + + + Portfolio Profit + + + + + + + savings{{ depotCurrentValue.toFixed(2) }} + + + paid{{ depotCost.toFixed(2) }} + + + account_balance= 0, red: profit < 0 }" + >{{ profit.toFixed(2) }} + + + + - Transaktionen + Transactions { - console.log('PORTFOLIO:' + response); var data = JSON.parse(response); for (let i = 0; i < data.data.length; i++) { + this.depotCurrentValue += data.data[i].current_price; STOCK_DATA.push({ count: data.data[i].count, currentPrice: data.data[i].current_price, @@ -58,14 +67,16 @@ export class DashboardComponent implements OnInit { time: data.data[i].last_transaction, }); } - console.log(STOCK_DATA); this.dataSourceStocks = STOCK_DATA; //TODO move to helper service + + this.profit += this.depotCurrentValue; }); + this.dataService.getTransactionData().subscribe((response: any) => { - console.log('TRANSACTIONS:' + response); var data = JSON.parse(response); for (let i = 0; i < data.data.length; i++) { + this.depotCost += data.data[i].price; TRANSACTION_DATA.push({ symbol: data.data[i].symbol, time: data.data[i].time, @@ -73,9 +84,10 @@ export class DashboardComponent implements OnInit { price: data.data[i].price, }); } - console.log(TRANSACTION_DATA); this.dataSourceTransactions = TRANSACTION_DATA; //TODO move to helper service + + this.profit -= this.depotCost; }); }