Bisq markets: Volume and other fixes.

This commit is contained in:
softsimon
2021-03-10 23:02:55 +07:00
parent d99fd5d59a
commit 1d4ed85d50
9 changed files with 57 additions and 26 deletions

View File

@@ -457,8 +457,8 @@ class BisqMarketsApi {
}
}
get24hVolumes(): MarketVolume[] {
const timestamp_from = new Date().getTime() / 1000 - 86400;
getVolumesByTime(time: number): MarketVolume[] {
const timestamp_from = new Date().getTime() / 1000 - time;
const timestamp_to = new Date().getTime() / 1000;
const trades = this.getTradesByCriteria(undefined, timestamp_to, timestamp_from,

View File

@@ -203,7 +203,7 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/ticker', routes.getBisqMarketTicker.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/trades', routes.getBisqMarketTrades.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/volumes', routes.getBisqMarketVolumes.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/24hvolumes', routes.getBisqMarket24hVolumes.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/volumes/7d', routes.getBisqMarketVolumes7d.bind(routes))
;
}

View File

@@ -401,12 +401,12 @@ class Routes {
}
}
public getBisqMarket24hVolumes(req: Request, res: Response) {
const result = bisqMarket.get24hVolumes();
public getBisqMarketVolumes7d(req: Request, res: Response) {
const result = bisqMarket.getVolumesByTime(604800);
if (result) {
res.json(result);
} else {
res.status(500).json(this.getBisqMarketErrorResponse('getBisqMarket24hVolumes error'));
res.status(500).json(this.getBisqMarketErrorResponse('getBisqMarketVolumes7d error'));
}
}