mirror of
https://github.com/mempool/mempool.git
synced 2025-02-28 16:58:32 +01:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||
|
import { Observable, combineLatest } from 'rxjs';
|
||
|
import { map } from 'rxjs/operators';
|
||
|
import { BisqApiService } from '../bisq-api.service';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-bisq-dashboard',
|
||
|
templateUrl: './bisq-dashboard.component.html',
|
||
|
styleUrls: ['./bisq-dashboard.component.scss'],
|
||
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||
|
})
|
||
|
export class BisqDashboardComponent implements OnInit {
|
||
|
tickers$: Observable<any>;
|
||
|
|
||
|
constructor(
|
||
|
private bisqApiService: BisqApiService,
|
||
|
) { }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
this.tickers$ = combineLatest([
|
||
|
this.bisqApiService.getMarketsTicker$(),
|
||
|
this.bisqApiService.getMarkets$()
|
||
|
])
|
||
|
.pipe(
|
||
|
map(([tickers, markets]) => {
|
||
|
const newTickers = [];
|
||
|
for (const t in tickers) {
|
||
|
tickers[t].pair_url = t;
|
||
|
tickers[t].pair = t.replace('_', '/').toUpperCase();
|
||
|
tickers[t].market = markets[t];
|
||
|
newTickers.push(tickers[t]);
|
||
|
}
|
||
|
console.log(newTickers);
|
||
|
return newTickers;
|
||
|
})
|
||
|
);
|
||
|
}
|
||
|
|
||
|
trackByFn(index: number) {
|
||
|
return index;
|
||
|
}
|
||
|
|
||
|
}
|