Markets api: Add missing "timestamp" parameter for /hloc and /volumes

This commit is contained in:
softsimon
2020-09-17 15:38:25 +07:00
parent 43e605d611
commit 34a2970ff7
3 changed files with 15 additions and 5 deletions

View File

@@ -110,7 +110,7 @@ interface Market {
}
export interface HighLowOpenClose {
period_start: number;
period_start: number | string;
open: string;
high: string;
low: string;

View File

@@ -212,6 +212,7 @@ class BisqMarketsApi {
timestamp_to?: number,
interval: Interval = 'auto',
milliseconds?: boolean,
timestamp: 'no' | 'yes' = 'yes',
): MarketVolume[] {
if (milliseconds) {
timestamp_from = timestamp_from ? timestamp_from / 1000 : timestamp_from;
@@ -256,7 +257,7 @@ class BisqMarketsApi {
if (intervals.hasOwnProperty(p)) {
const period = intervals[p];
marketVolumes.push({
period_start: period['period_start'],
period_start: timestamp === 'no' ? new Date(period['period_start'] * 1000).toISOString() : period['period_start'],
num_trades: period['num_trades'],
volume: this.intToBtc(period['volume']),
});
@@ -358,6 +359,7 @@ class BisqMarketsApi {
timestamp_from?: number,
timestamp_to?: number,
milliseconds?: boolean,
timestamp: 'no' | 'yes' = 'yes',
): HighLowOpenClose[] {
if (milliseconds) {
timestamp_from = timestamp_from ? timestamp_from / 1000 : timestamp_from;
@@ -386,7 +388,7 @@ class BisqMarketsApi {
if (intervals.hasOwnProperty(p)) {
const period = intervals[p];
hloc.push({
period_start: period['period_start'],
period_start: timestamp === 'no' ? new Date(period['period_start'] * 1000).toISOString() : period['period_start'],
open: this.intToBtc(period['open']),
close: this.intToBtc(period['close']),
high: this.intToBtc(period['high']),