getProductsStats method

Future<List<ProductStats>> getProductsStats()

Undocumented endpoint which gives the last price for trading pairs

/products/stats

Implementation

Future<List<ProductStats>> getProductsStats() async {
  var response = await _productsRestClient.getProductsStats();

  if (response.statusCode != 200) throw response;

  Map<String, dynamic> stats = json.decode(response.body);

  var stuff = stats.entries
      .map((entry) => ProductStats(
            tradingPair: entry.key,
            stats30Day: Stats.fromJson(entry.value['stats_30day']),
            stats24Hour: Stats.fromJson(entry.value['stats_24hour']),
          ))
      .toList();
  return stuff;
}