2

I am planning to build a webpage where a user can enter his/her stock of various cryptocurrencies, and the webpage should display the current market value (in USD) for each of the cryptocurrency he/she has chosen.

I was wondering from where (which website/database) I can import the live market value for cryptocurrencies, so I can use the values in my website script?

Thank you very much in advance.

2 Answers 2

0

You can import straight from the exchanges market API.

Php example

$url = "https://api.bitfinex.com/v1/ticker/btcusd";
$json = json_decode(file_get_contents($url), true);
$price = $json["last_price"];
echo $price;

Javascript xml

var xbtc = new XMLHttpRequest();
        xbtc.open('GET',         'https://api.bitcoinaverage.com/ticker/global/USD/', true);
        xbtc.onreadystatechange = function(){
        if(xbtc.readyState == 4){
            var ticker = JSON.parse(xbtc.responseText);
            var price = ticker.last;
        document.getElementById('MyDiv').innerHTML = "$" + price;
        }
        };
        xbtc.send();

http://btcthreads.com/display-the-exchange-rate-on-your-website/

0
0

Take a look here: https://blockchain.info/api

https://blockchain.info/ticker gives you a json-object with recent data.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.