commit 5a26b3d4c4c3700ffe6e7c539fd540cd2bb4a1b0
parent 4084d1ca6f34a45898c9bc3e639fa3188aee1eb8
Author: NicholasFarrow <nicholas.w.farrow@gmail.com>
Date: Mon, 14 Dec 2020 22:29:15 +1100
add invoice class
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/invoice/__init__.py b/invoice/__init__.py
@@ -0,0 +1,5 @@
+from .price_feed import get_btc_value
+
+class invoice():
+ def __init__(self, dollar_value, currency):
+ self.value = get_btc_value(dollar_value, currency)
diff --git a/invoice/price_feed.py b/invoice/price_feed.py
@@ -24,7 +24,7 @@ def get_btc_value(dollar_value, currency):
if (price := get_price(currency)) is not None:
try:
- float_value = float(price) * dollar_value
+ float_value = dollar_value / float(price)
if not isinstance(float_value, float):
raise Exception("Dollar value should be a float.")
except Exception as e: