Wednesday, July 31, 2013

How to display Mt.Gox Bitcoin data in your website - AJAX request to retrieve market prices for Bitcoin at Mt.Gox

With my miners wasting time in the customs office i will use the time to spread some useful information. At least for the aspiring developers among you.
Here's a little jquery snippet which will fetch you the current Bitcoin exchange rate.
The example requests US dollars, and inserts the data in various ticker fields.

<script type="text/javascript">
$(function() {
    $(document).ready(function(){
        $.getJSON('https://data.mtgox.com/api/1/BTCUSD/ticker', function(data) {
            $('#ticker-high').html(data['return'].high.display_short);
            $('#ticker-low').html(data['return'].low.display_short);
            $('#ticker-avg').html(data['return'].avg.display_short);
            $('#ticker-volume').html(data['return'].vol.display_short);
            $('#ticker-buy').html(data['return'].buy.display_short);
            $('#ticker-sell').html(data['return'].sell.display_short);
        });
    });
})
</script>

Obviously for this to work you need some jquery running. I recommend the use of a content delivery network for this. Cloudflare offers a great service for this called cdnjs.com which also supports ssl.

Hope i could help you. If you like some advice on how to save a complete history of the bitcoin trade networks to your database please leave me a comment.

I also like to say sorry for the recent troubles with the coin-inc collector. There were some errors with the time zone settings on the new server but we fixed it.
Also, the forwarding to the next faucet happens automatically now. You just need to fill the capture and press enter... then again... then again... ;-)
We are working in all spare time on a new setup which will further ease the collection of free Bitcoin taking out the need to change between the faucet sites. If you like to support the development please find a donation address at coin-inc.com.

Have a good day and see you soon forum!

Tim

2 comments:

  1. ¥¥¥¥¥¥¥ BTC FAUCET ROTATOR €€€€€€€
    * CLAIM AT LEAST 10k Satoshi in 5 MINs.
    * HIGHEST Satoshis per Claim ratio.
    * HIGHEST PAYING FAUCETS, starting at 5,000 satoshi per claim.
    £££££££ www.iacbit.org/faucet-rotator/ ¥¥¥¥¥¥¥

    ReplyDelete
  2. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. crypto gaming

    ReplyDelete