0

How can I fetch the GDAX 24 hours percentage for each products?

Should I request current price and current-24hours price and process the difference ? Or is there a better way ?

Charly berthet
  • 1,178
  • 5
  • 15
  • 31

1 Answers1

1

This is how I do it...

$stats = fetchFromGDAX("/products/$product-USD/stats");
$x = round((($stats['last']-$stats['open'])/$stats['open'])*100,3);

( fetchFromGDAX() is my function to handle the API call )

This returns something like... -3.394%

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
Thom
  • 11
  • 4