utiliser to_euro() partout
This commit is contained in:
@@ -24,6 +24,7 @@ from ..models.members import (
|
||||
# import datetime
|
||||
import time
|
||||
import hashlib
|
||||
import locale
|
||||
import json
|
||||
import yfinance as yf
|
||||
|
||||
@@ -32,18 +33,14 @@ def to_decimal(x):
|
||||
return decimal.Decimal(str(x))
|
||||
|
||||
def to_euro(x):
|
||||
"""Takes a float and returns a string"""
|
||||
#if x == 0:
|
||||
# return ""
|
||||
#else:
|
||||
return (u"{:,.2f}".format(x).replace(',', ' ').replace('.', ',') + " €")
|
||||
"""Takes a float and returns 12 345,67 €"""
|
||||
locale.setlocale(locale.LC_ALL,'')
|
||||
return locale.currency(x, True, True)
|
||||
|
||||
def to_usd(x):
|
||||
"""Takes a float and returns a string"""
|
||||
#if x == 0:
|
||||
# return ""
|
||||
#else:
|
||||
return (u"%.2f $" % x).replace('.', ',')
|
||||
locale.setlocale(locale.LC_ALL,'en-US')
|
||||
return locale.currency(x, True, True)
|
||||
|
||||
|
||||
def to_int(x):
|
||||
|
||||
Reference in New Issue
Block a user