33
44class BtcConverter (object ):
55 """
6- Get bit coin rates convert
6+ Get bit coin rates and convertion
77 """
88
99 def get_latest_price (self , currency ):
10+ """
11+ Get Lates price of one bitcoin to valid Currency 1BTC => X USD
12+ """
1013 url = 'https://api.coindesk.com/v1/bpi/currentprice/{}.json' .format (currency )
1114 response = requests .get (url )
1215 if response .status_code == 200 :
@@ -16,6 +19,9 @@ def get_latest_price(self, currency):
1619 return None
1720
1821 def get_previous_price (self , currency , date_obj ):
22+ """
23+ Get Price for one bit coin on given date
24+ """
1925 start = date_obj .strftime ('%Y-%m-%d' )
2026 end = date_obj .strftime ('%Y-%m-%d' )
2127 url = (
@@ -32,6 +38,9 @@ def get_previous_price(self, currency, date_obj):
3238 return None
3339
3440 def get_previous_price_list (self , currency , start_date , end_date ):
41+ """
42+ Get List of prices between two dates
43+ """
3544 start = start_date .strftime ('%Y-%m-%d' )
3645 end = end_date .strftime ('%Y-%m-%d' )
3746 url = (
@@ -48,6 +57,9 @@ def get_previous_price_list(self, currency, start_date, end_date):
4857 return {}
4958
5059 def convert_to_btc (self , amount , currency ):
60+ """
61+ Convert X amount to Bit Coins
62+ """
5163 url = 'https://api.coindesk.com/v1/bpi/currentprice/{}.json' .format (currency )
5264 response = requests .get (url )
5365 if response .status_code == 200 :
@@ -60,6 +72,9 @@ def convert_to_btc(self, amount, currency):
6072 return None
6173
6274 def convert_btc_to_cur (self , coins , currency ):
75+ """
76+ Convert X bit coins to valid currency amount
77+ """
6378 url = 'https://api.coindesk.com/v1/bpi/currentprice/{}.json' .format (currency )
6479 response = requests .get (url )
6580 if response .status_code == 200 :
@@ -72,6 +87,9 @@ def convert_btc_to_cur(self, coins, currency):
7287 return None
7388
7489 def convert_to_btc_on (self , amount , currency , date_obj ):
90+ """
91+ Convert X amount to BTC based on given date rate
92+ """
7593 start = date_obj .strftime ('%Y-%m-%d' )
7694 end = date_obj .strftime ('%Y-%m-%d' )
7795 url = (
@@ -91,6 +109,9 @@ def convert_to_btc_on(self, amount, currency, date_obj):
91109 return None
92110
93111 def convert_btc_to_cur_on (self , coins , currency , date_obj ):
112+ """
113+ Convert X BTC to valid currency amount based on given date
114+ """
94115 start = date_obj .strftime ('%Y-%m-%d' )
95116 end = date_obj .strftime ('%Y-%m-%d' )
96117 url = (
@@ -110,4 +131,7 @@ def convert_btc_to_cur_on(self, coins, currency, date_obj):
110131 return None
111132
112133 def get_symbol (self ):
134+ """
135+ Here is Unicode symbol for bit coin
136+ """
113137 return "\u0E3F "
0 commit comments