#NEWLINE# def get_current_price( self , crypto , fiat ) : #NEWLINE# #INDENT# url_template = 'http://data.bter.com/api/1/ticker/%s_%s' #NEWLINE# url = ( crypto % ( crypto , fiat ) ) #NEWLINE# response = self . get_url ( url ) . json ( ) #NEWLINE# if ( response [ 'result' ] == 'false' ) : #NEWLINE# #INDENT# url = ( url_template % ( crypto , 'btc' ) ) #NEWLINE# response = self . get_url ( url ) #NEWLINE# altcoin_btc = float ( response [ 'last' ] ) #NEWLINE# url = ( url_template % ( 'btc' , fiat ) ) #NEWLINE# response = self . get_url ( url ) #NEWLINE# btc_fiat = float ( response [ 'last' ] ) #NEWLINE# self . name = 'BTER (calculated)' #NEWLINE# return ( btc_fiat * altcoin_btc ) #NEWLINE# #UNINDENT# return float ( ( response [ 'last' ] or 0 ) )