All files data.ts

100% Statements 8/8
100% Branches 0/0
100% Functions 6/6
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 391x                         5x       1x       4x       2x       1x       2x       1x  
import Common from './common';
import { CandlesQueryString } from './interfaces/candles.interface';
import { MarketStats, MarketStatsQueryString } from './interfaces/markets.interface';
import { Orderbook, OrderbookQueryString } from './interfaces/orderbook.interface';
import { Product } from './interfaces/products.interface';
import { Trade, TradeQueryString } from './interfaces/trades.interface';
 
class Data {
  private common: Common;
 
  constructor(
    sandbox?: boolean,
  ) {
    this.common = new Common(sandbox, 'data');
  }
 
  public async getProductTicker(id: string): Promise<Product> {
    return this.common.request(false, 'get', `products/${id}/ticker`);
  }
 
  public async getTrades(id: string, qs?: TradeQueryString): Promise<Trade[]> {
    return this.common.request(false, 'get', `products/${id}/trades`, qs);
  }
 
  public async getOrderbook(id: string, qs?: OrderbookQueryString): Promise<Orderbook> {
    return this.common.request(false, 'get', `products/${id}/book`, qs);
  }
 
  public async getCandles(id: string, qs: CandlesQueryString): Promise<[string, string, string, string][]> {
    return this.common.request(false, 'get', `products/${id}/candles`, qs);
  }
 
  public async getMarketStats(id: string, qs?: MarketStatsQueryString): Promise<MarketStats> {
    return this.common.request(false, 'get', `products/${id}/stats`, qs);
  }
}
 
export default Data;