Fix Stock pannel and data
This commit is contained in:
parent
7f671c96ce
commit
653762545e
@ -12,28 +12,36 @@
|
||||
The actual rendered columns are set as a property on the row definition" -->
|
||||
|
||||
<!-- Symbol Column -->
|
||||
<ng-container matColumnDef="position">
|
||||
<th mat-header-cell *matHeaderCellDef>Symbol</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.symbol }}</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Count Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<ng-container matColumnDef="count">
|
||||
<th mat-header-cell *matHeaderCellDef>Count</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.count }}</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Time Column -->
|
||||
<ng-container matColumnDef="weight">
|
||||
<th mat-header-cell *matHeaderCellDef>Time</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.time }}</td>
|
||||
<!-- Count Column -->
|
||||
<ng-container matColumnDef="comment">
|
||||
<th mat-header-cell *matHeaderCellDef>Comment</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.comment }}</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Time Column -->
|
||||
<ng-container matColumnDef="current-price">
|
||||
<th mat-header-cell *matHeaderCellDef>Current Price</th>
|
||||
<ng-container matColumnDef="isin">
|
||||
<th mat-header-cell *matHeaderCellDef>ISIN</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.isin }}</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Symbol Column -->
|
||||
<ng-container matColumnDef="current_price">
|
||||
<th mat-header-cell *matHeaderCellDef>Price</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
{{ element.currentPrice }}
|
||||
{{ element.current_price }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Time Column -->
|
||||
<ng-container matColumnDef="last_transaction">
|
||||
<th mat-header-cell *matHeaderCellDef>Last Transaction</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
{{ element.last_transaction }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
@ -6,9 +6,10 @@ import { HelperService } from 'src/app/Helpers/helper.service';
|
||||
|
||||
export interface Stock {
|
||||
count: number;
|
||||
currentPrice: number;
|
||||
symbol: string;
|
||||
time: string;
|
||||
comment: string;
|
||||
isin: string;
|
||||
last_transaction: string;
|
||||
current_price: number;
|
||||
}
|
||||
|
||||
var TRANSACTION_DATA: TransactionData[] = [];
|
||||
@ -65,19 +66,20 @@ export class DashboardComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.dataService.getStockData().subscribe((response: any) => {
|
||||
var data = JSON.parse(response);
|
||||
console.log(data);
|
||||
this.depotCurrentValue = 0;
|
||||
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,
|
||||
symbol: data.data[i].symbol,
|
||||
time: data.data[i].last_transaction,
|
||||
comment: data.data[i].comment,
|
||||
isin: data.data[i].isin,
|
||||
last_transaction: data.data[i].last_transaction,
|
||||
current_price: data.data[i].current_price,
|
||||
});
|
||||
}
|
||||
console.log(STOCK_DATA);
|
||||
this.dataSourceStocks = STOCK_DATA;
|
||||
//TODO move to helper service
|
||||
|
||||
this.profit += this.depotCurrentValue;
|
||||
});
|
||||
|
||||
@ -133,9 +135,10 @@ export class DashboardComponent implements OnInit {
|
||||
'symbol',
|
||||
];
|
||||
displayedColumnsStocks: string[] = [
|
||||
'position',
|
||||
'name',
|
||||
'weight',
|
||||
'current-price',
|
||||
'count',
|
||||
'comment',
|
||||
'isin',
|
||||
'current_price',
|
||||
'last_transaction',
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user