Why Bitcoinchain.info Ticker API is not stable?

0

I am trying to use Blockchain.info Ticker API (https://blockchain.info/ticker) to get current BTC price in USD.

The interesting thing is that script not every time returns the same value. When you visit this page directly, none of the values never changes (well just every 15mins) https://blockchain.info/ticker, but on the script it changes on every nth refresh of the page.

Something similar happens if you go to blockchain.info/ticker? with at least a question mark added. Just refresh it a lot and you will see.

Why this is happening and how to get a stable price every 15mins as their API should provide it?

The script I use:

$api = "https://blockchain.info/ticker";
$json = file_get_contents($api);
$data = json_decode($json, TRUE);
$rate = $data["USD"]["sell"];
echo $rate;

Simon

Posted 2017-03-07T12:34:44.853

Reputation: 101

Answers

1

There's nothing wrong with your PHP syntax or blockchain.info. The Bitcoin value is always changing. It is traded 365 days a year, 24 hours a day on a multiple exchanges around the globe.

m1xolyd1an

Posted 2017-03-07T12:34:44.853

Reputation: 3 356

I understand that mate. It just seems strange that it changes to the same value over and over again. For example if it's 1200$ in that ~15minutes period it sometimes changes to something value-10, like in this case to 1190$ while refreshing.Simon 2017-03-11T17:12:11.703