API tips for bitcoin quota checking [closed]

0
Hello, I'm new to this bid from Bitcoin, and I've looked for some APIs to check the currency quotes, however the ones I found I did not quite understand how they work, someone who understands more about the subject can help me recommend some easy API to use?

    
asked by anonymous 13.10.2017 / 01:37

1 answer

1

There is the Bitcoin Market API, it is extremely simple and lightweight works with JSON. It's publish does not need authenticity for prices

https://www.mercadobitcoin.net/api/BTC/ticker/

Returns

{"ticker": 
    {"high": "17770.00000000", 
     "low": "17420.00000000", 
     "vol": "316.44974311", 
     "last": "17430.90199000", 
     "buy": "17430.90199000", 
     "sell": "17487.00000000", 
     "date": 1508016142
    }
}

Now to make a function look very simple with python

    import json
    import urllib2

    def get_btc():
        response = urllib2.urlopen('https://www.mercadobitcoin.net/api/BTC/ticker/')
        json_str = response.read()
        btc_data = json.loads(json_str)
        return btc_data['ticker']

btc_ticker = def get_btc()

 print "O preco do Bitcoin agora e: R$ {:.2f}".format(float(btc_ticker['last']))
    
14.10.2017 / 23:41