Преглед изворни кода

Conversion of Decimal.decimal to float

Foppe Hemminga пре 6 година
родитељ
комит
5cae15c5f3
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      view.py

+ 1 - 1
view.py

@@ -13,7 +13,7 @@ def create_message(name, timestamp, price, quantity):
     :return:
     """
     this_time = datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
-    this_drop_decimal = float(quantity * (price * 1.0) / 1e9)
+    this_drop_decimal = float((quantity * 1.0) * (price * 1.0) / 1e9)
     this_message = "{}: {} dropped {} shares at ${:.2f} for a grand total of ${:.1f}B".format(
         this_time, name, quantity, price, this_drop_decimal)
     return this_message