Bisq markets dashboard: 24H Volume. WIP.

This commit is contained in:
softsimon
2021-02-28 17:18:29 +07:00
parent eeb7447988
commit 38e866995f
7 changed files with 63 additions and 13 deletions

View File

@@ -457,6 +457,30 @@ class BisqMarketsApi {
}
}
get24hVolumes(): MarketVolume[] {
const timestamp_from = new Date().getTime() / 1000 - 86400;
const timestamp_to = new Date().getTime() / 1000;
const trades = this.getTradesByCriteria(undefined, timestamp_to, timestamp_from,
undefined, undefined, undefined, 'asc', Number.MAX_SAFE_INTEGER);
const markets: any = {};
for (const trade of trades) {
if (!markets[trade._market]) {
markets[trade._market] = {
'volume': 0,
'num_trades': 0,
};
}
markets[trade._market]['volume'] += this.fiatCurrenciesIndexed[trade.currency] ? trade._tradeAmount : trade._tradeVolume;
markets[trade._market]['num_trades']++;
}
return markets;
}
private getTradesSummarized(trades: TradesData[], timestamp_from: number, interval?: string): SummarizedIntervals {
const intervals: any = {};
const intervals_prices: any = {};